Login  Register

Re: How to bring up the Foreground Color dialog

Posted by Michael Schmid on Sep 17, 2020; 1:09pm
URL: http://imagej.273.s1.nabble.com/How-to-bring-up-the-Foreground-Color-dialog-tp5023959p5023960.html

Hi Stein,

here is a JavaScript example:

c=Toolbar.getForegroundColor();
cNew=new ColorChooser("select foreground", c, false).getColor();
Toolbar.setForegroundColor(cNew);

I don't know a specific macro command, but you can use 'eval' to use
JavaScript code in a macro. It's one long line; if the mailer should
split it, you have to make one line out of it:

eval('js','Toolbar.setForegroundColor(new ColorChooser("select
foreground", Toolbar.getForegroundColor(), false).getColor());');

The same should work for the background (I have not tried that).
---

Setting the foreground to 'red' etc:
With the recent daily builds, right-click the color picker icon and you
have a choice of the most common colors.

Nevertheless, I agree that it would be nice to have the TextField at the
bottom of the CP accepting input. It looks fairly simple - just that
someone would have to do it...

Michael
________________________________________________________________
On 17.09.20 13:53, Stein Rørvik wrote:

> I wonder if there is any way to launch the set Foreground Color dialog (the one with three sliders/numbers) in the GUI besides first opening the color picker, and then double click a color? The same question applies to the Background Color dialog. Also, how to do this in a macro?
>
> What about adding entries named "Foreground..." and "Background..." for doing exactly this, above or below the "Color Picker" entry in the new and very useful right-click-menu of the color picker tool icon?
>
> A related request:
> In the color picker, the name of the color is written as a copyable word like "black" or "red" in the bottom of the picker.
> What about making this editable, so that one can just type "red" to set the current foreground or background color to that?
> For the colors that do not match the predefined names, one could also here be allowed to type a hex triplet like #56b900.
>
> Stein
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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