Login  Register

Re: Color Names

Posted by Wayne Rasband-2 on Apr 29, 2019; 4:37pm
URL: http://imagej.273.s1.nabble.com/Color-Names-tp5022138p5022145.html


> On Apr 28, 2019, at 7:26 AM, Herbie <[hidden email]> wrote:
>
> Dear listers and dear Wayne,
>
> an inspection of the source code at
>
> <https://imagej.nih.gov/ij/source/ij/plugin/Colors.java>
>
> confirmed my experience that the following color names, e.g. as listed in the comment to the macro function "setColor(string)", are no longer supported by ImageJ:
>
> "darkGray"
> "lightGray"
> “pink"

The ImageJ 1.52p6 daily build adds support for these three colors. The following example macro displays all 13 named colors.

-wayne

  colors = newArray("black", "blue", "cyan", "darkGray",
     "gray", "green", "lightGray", "magenta", "orange",
     "pink", "red", "white", "yellow");
  width = 300;
  height = 400;
  n = colors.length;
  x = 15;
  y = 15;
  w = 0.9*width;
  h = height/n;
  inc = height/(n+1);
  newImage("Colors", "RGB black", width, height, 1);
  run("Add...", "value=90");
  setFont("SanSerif", 16, "bold antialiased")
  for (i=0; i<n; i++) {
     setColor(colors[i]);
     fillRect(x, y, w, h);
     setColor("white");
     drawString(colors[i], x+5, y+20);
     y += inc;
  }




>
> So, could someone please correct the list of allowed color names
>
> <https://imagej.nih.gov/ij/developer/macro/functions.html>
>
> and perhaps in other place where these names are wrongly listed.
>
> Many thanks
>
> Herbie

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Screenshot.png (338K) Download Attachment