How to get the current brush color ?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
How to get the current brush color ?
Hi All,
Is there a way to get the current brush color ?
It seems brushcolor property is "set only".
Best regards
Jean-Marc
Is there a way to get the current brush color ?
It seems brushcolor property is "set only".
Best regards
Jean-Marc
Last edited by jmburnod on Tue Jun 01, 2021 12:09 pm, edited 2 times in total.
https://alternatic.ch
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: How to get the current brush color ?
Thanks Bogs
It works now.
First try was empty because brushcolor was empty.
Best
Jean-Marc
It works now.
First try was empty because brushcolor was empty.
Best
Jean-Marc
https://alternatic.ch
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: How to get the current brush color ?SOLVED
Partly solved, mainly because I'm stupid and cannot work out from RGB numbers what a colour looks like.
I can type this:
but if I type:
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.
I can type this:
Code: Select all
set the brushColor to "red"
Code: Select all
put the brushColor
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.
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: How to get the current brush color ?
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.
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 ?
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.
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.
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: How to get the current brush color ?
This might be a good start:do you know of somewhere else
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:
- - -
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:
- -
https://web.njit.edu/~walsh/rgb.html
Re: How to get the current brush color ?
You seem to have left out a fairly important part of my question...
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.where you can translate the rgbColor into a colorName aside from brushColor in Lc ?
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.
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: How to get the current brush color ?
Indeed, I did not address it directly.You seem to have left out a fairly important part of my question...
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 . . . ]
Re: How to get the current brush color ?
No, but don't you think this might not only be a better solution, but an easier one?
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
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
Re: How to get the current brush color ?
You mean like this?richmond62 wrote: ↑Wed Jun 02, 2021 9:45 amAs 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."
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
-
- VIP Livecode Opensource Backer
- Posts: 7215
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: How to get the current brush color ?
I wouldn't mind having a copy of that chart. Where did you find it?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: How to get the current brush color ?
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 >
{ I suggest playing it back below 1x, possibly .75 or .5 even }