Page 1 of 2

How to get the current brush color ?

Posted: Tue Jun 01, 2021 9:04 am
by jmburnod
Hi All,
Is there a way to get the current brush color ?
It seems brushcolor property is "set only".
Best regards
Jean-Marc

Re: How to get the current brush color ?

Posted: Tue Jun 01, 2021 9:18 am
by bogs

Code: Select all

put the brushColor
works here JM ?

Image

Re: How to get the current brush color ?

Posted: Tue Jun 01, 2021 9:44 am
by jmburnod
Thanks Bogs
It works now.
First try was empty because brushcolor was empty. :oops:
Best
Jean-Marc

Re: How to get the current brush color ?SOLVED

Posted: Tue Jun 01, 2021 11:16 am
by richmond62
Partly solved, mainly because I'm stupid and cannot work out from RGB numbers what a colour looks like.

I can type this:

Code: Select all

set the brushColor to "red"
but if I type:

Code: Select all

put the brushColor
I always get an RGB set back.

It would be lovely if one could do this sort of thing:

*get the colorName of the brushColor*

and one would get "green", "blue" or whatever.

Re: How to get the current brush color ?SOLVED

Posted: Tue Jun 01, 2021 12:02 pm
by bogs
Um...
Image

Re: How to get the current brush color ?

Posted: Tue Jun 01, 2021 2:34 pm
by richmond62
Well, Yes . . .

BUT one cannot, for the sake of argument set the brushColor to 123,234,111
and then get it to return a colorname.

Re: How to get the current brush color ?

Posted: Tue Jun 01, 2021 8:39 pm
by bogs
For the sake of argument, do you know of somewhere else where you can translate the rgbColor into a colorName aside from brushColor in Lc ? Also, aren't there a limited number of colorNames, as opposed to rgb value combinations, hence there wouldn't be a colorName to correspond to every particular triplet value?

On the other hand, if you assign a colorName to a brushColor, I'm pretty sure that is what you'll get back, as demonstrated above.

Re: How to get the current brush color ?

Posted: Wed Jun 02, 2021 9:22 am
by richmond62
do you know of somewhere else
This might be a good start:

https://www.color-blindness.com/color-name-hue/

"The list of colors comprises 1640 different color names" . . . cripes.

The snag about that website is that the chap who did the work cooked up some distinctly personal names, hence:
-
SShot 2021-06-02 at 11.25.37.png
-
SShot 2021-06-02 at 11.25.06.png
-

I can see it was made using Java script.

This is, also, not bad:

https://htmlcolorcodes.com/color-names/

However, nobody but nobody is going to cook up this number of names:
-
SShot 2021-06-02 at 11.29.16.png
-

https://web.njit.edu/~walsh/rgb.html

Re: How to get the current brush color ?

Posted: Wed Jun 02, 2021 9:37 am
by bogs
richmond62 wrote:
Wed Jun 02, 2021 9:22 am
do you know of somewhere else
You seem to have left out a fairly important part of my question...
where you can translate the rgbColor into a colorName aside from brushColor in Lc ?
If all your looking for is a list of names you can translate rgbColor values into, I'm sure any random name generator will work for that, but I don't see how it would be any more helpful than just having the values.

I'm also not sure that using names is better than rgb values, I've seen some colorNames that are way off the mark or just plain silly, but I know for a given value approximately how bright or dark the red, green, and blue will turn out.

Re: How to get the current brush color ?

Posted: Wed Jun 02, 2021 9:45 am
by richmond62
You seem to have left out a fairly important part of my question...
Indeed, I did not address it directly.

But I am sure that with a little bit of 'jiggery-pokery' one could use the resources from that website with the 1640 colour names
(or any one of the fairly large number that came up with a quick Ecosia web search) to set up
a look-up table that could be incorporated into a stack . . .

As I am a tableField fan one could have a tableField with 3 columns:

RGB
HEX
name

and the rest, as they say, would be "boot scoot and boogie."

[something wrong with that reference, I'm sure . . . 8) ]

Re: How to get the current brush color ?

Posted: Wed Jun 02, 2021 9:51 am
by bogs
No, but don't you think this might not only be a better solution, but an easier one?

Image

Values don't help you, *names are arbitrary, but seeing the actual color should leave little doubt as to what your working with.


*Names - what does "AliceBlue" mean to you? To me, it suggests Alice should try to cheer up :P

Re: How to get the current brush color ?

Posted: Wed Jun 02, 2021 9:57 am
by bogs
richmond62 wrote:
Wed Jun 02, 2021 9:45 am
As I am a tableField fan one could have a tableField with 3 columns:

RGB
HEX
name

and the rest, as they say, would be "boot scoot and boogie."
You mean like this?

Image

Re: How to get the current brush color ?

Posted: Wed Jun 02, 2021 4:21 pm
by richmond62
You mean like this?
Just so!
-
blueMeanie.jpeg
blueMeanie.jpeg (10.71 KiB) Viewed 5347 times
-
Blue Meanie: an off-spectrum colour. 8)

https://youtu.be/ePaHG6g7uFw

Re: How to get the current brush color ?

Posted: Wed Jun 02, 2021 6:45 pm
by jacque
I wouldn't mind having a copy of that chart. Where did you find it?

Re: How to get the current brush color ?

Posted: Wed Jun 02, 2021 10:45 pm
by bogs
jacque wrote:
Wed Jun 02, 2021 6:45 pm
I wouldn't mind having a copy of that chart. Where did you find it?
If you click the picture, you'll see exactly where I found it < I made it myself, it is part of the "15 minutes of LiveCode channel I host > :D

{ I suggest playing it back below 1x, possibly .75 or .5 even }