Hi All,
I have a problem... If a user selects a color and I put it into a variable (as RGB), how can I find a shade that is several shades lighter, and a shade that is several shades darker, also in RGB format?
For example, I put 0,255,64 into myVar. (This color a shade of green.) Programmatically, how can I find a shade that is several shades lighter in green and a shade that is several shades darker in green from this base color?
(By the way... Is there a way in LiveCode to determine the hue, saturation, and brightness of a color and change the values?)
Any help would be most appreciated...
Thanks!
- Boo
Way to find a lighter and darker shade of a RGB color?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 348
- Joined: Sun Jul 03, 2011 2:04 am
- Location: Gulf Breeze, Florida
-
- VIP Livecode Opensource Backer
- Posts: 4002
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Way to find a lighter and darker shade of a RGB color?
Hi Keith,
I made a little stack to do what you want. It uses RGB colors.
In a stack on RevOnline "EasterEgg" I use a HSV-RGB and the RGB-HSV library which is originally from Monte Goulding. They are in the card scipt.
http://revonline2.runrev.com/stack/347/EasterEgg
or via user samples from within Livecode
Kind regards
Bernd
I made a little stack to do what you want. It uses RGB colors.
In a stack on RevOnline "EasterEgg" I use a HSV-RGB and the RGB-HSV library which is originally from Monte Goulding. They are in the card scipt.
http://revonline2.runrev.com/stack/347/EasterEgg
or via user samples from within Livecode
Kind regards
Bernd
-
- VIP Livecode Opensource Backer
- Posts: 348
- Joined: Sun Jul 03, 2011 2:04 am
- Location: Gulf Breeze, Florida
Re: Way to find a lighter and darker shade of a RGB color?
Bernd,
Your script for finding lighter and darker versions of a color are exactly what I needed for a non-commercial project I'm working on. I'm assuming since you've posted it in a public forum that you will not object to it's reuse (in an adapted version). I would like to give you credit for the script some place in the project -- probably on the Credits card (subject to the approval of the developer) and most certainly in the comments before your code, if you could kindly let me know how you would like the credit to read.
Thanks so much.
John
Your script for finding lighter and darker versions of a color are exactly what I needed for a non-commercial project I'm working on. I'm assuming since you've posted it in a public forum that you will not object to it's reuse (in an adapted version). I would like to give you credit for the script some place in the project -- probably on the Credits card (subject to the approval of the developer) and most certainly in the comments before your code, if you could kindly let me know how you would like the credit to read.
Thanks so much.
John
-
- VIP Livecode Opensource Backer
- Posts: 4002
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Way to find a lighter and darker shade of a RGB color?
Hi John,
Please feel free to use it any way you want, no need to credit me. If you want to put a link to the stack in the script you may want to reference this thread.
Kind regards
Bernd
glad you liked it and that it did help you. It is not rocket science but handy to have if needed.Your script for finding lighter and darker versions of a color are exactly what I needed for a non-commercial project I'm working on. I'm assuming since you've posted it in a public forum that you will not object to it's reuse (in an adapted version)
Please feel free to use it any way you want, no need to credit me. If you want to put a link to the stack in the script you may want to reference this thread.
Kind regards
Bernd