How to bring up the Foreground Color dialog

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to bring up the Foreground Color dialog

Stein Rørvik
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
Reply | Threaded
Open this post in threaded view
|

Re: How to bring up the Foreground Color dialog

Michael Schmid
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
Reply | Threaded
Open this post in threaded view
|

Re: How to bring up the Foreground Color dialog

Stein Rørvik
Thanks,

I usually add such short javascripts to my macros by just assembling a multi-line string and then pass it to eval function; that makes it more readable than a long one-liner. Your code works fine:

//Set Foreground Color dialog:
javascript = "";
javascript += "c =Toolbar.getForegroundColor();\n";
javascript += "cNew = new ColorChooser('select foreground', c, false).getColor();\n";
javascript += "Toolbar.setForegroundColor(cNew);";
eval("script", javascript);

This also works for the background:

//Set Background Color dialog:
javascript = "";
javascript += "c =Toolbar.getBackgroundColor();\n";
javascript += "cNew = new ColorChooser('select background', c, false).getColor();\n";
javascript += "Toolbar.setBackgroundColor(cNew);";
eval("script", javascript);

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael Schmid
Sent: 17. september 2020 15:10
To: [hidden email]
Subject: Re: How to bring up the Foreground Color dialog

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: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no%7Cb609b9d4cf8f4a88534a08d85b0b0fad%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C1%7C637359450363463940&amp;sdata=X1FkcXS53WiyHs5bEpFYJ5pXQLM3WLt6iANUoZsOCkk%3D&amp;reserved=0
>

--
ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no%7Cb609b9d4cf8f4a88534a08d85b0b0fad%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C1%7C637359450363463940&amp;sdata=X1FkcXS53WiyHs5bEpFYJ5pXQLM3WLt6iANUoZsOCkk%3D&amp;reserved=0

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to bring up the Foreground Color dialog

Wayne Rasband-2
In reply to this post by Stein Rørvik
> On Sep 17, 2020, at 7:53 AM, Stein Rørvik <[hidden email]> 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?

The ImageJ 1.53f1 daily build adds "Foreground..." and "Background…” items to the 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.

I will work on this.
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to bring up the Foreground Color dialog

Stein Rørvik
Thank you, works great!

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne Rasband
Sent: 17. september 2020 21:11
To: [hidden email]
Subject: Re: How to bring up the Foreground Color dialog

> On Sep 17, 2020, at 7:53 AM, Stein Rørvik <[hidden email]> 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?

The ImageJ 1.53f1 daily build adds "Foreground..." and "Background…” items to the 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.

I will work on this.
--
ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no%7Cb993e3162f3a4bd7796d08d85b3e9e07%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637359671799666560&amp;sdata=tvTBwcg0f%2FCmZXuQnVRM0MA9xDhL0gBqS9LDbwQXhmI%3D&amp;reserved=0

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