Color names vs hex codes
Howard Bornstein
bornstein at designeq.com
Wed Jan 9 00:32:37 EST 2013
This is what I use:
*function* RGBFromColorName theColor
*if* theColor is not a color *then* *return* "Error: not a color"
*-- create a temporary object for the color transformation:*
*create* invisible button
*if* the result is not empty *then* *return* "Error"
*set* the backgroundColor of last button to theColor
*-- transform the color using the backgroundPixel trick:*
*set* the backgroundPixel of last button to the backgroundPixel of last
button
*-- the button's backgroundColor is now RGB:*
*get* the backgroundColor of last button
*delete* last button *-- don't need the temp object any more*
*-- the create command automatically chose the pointer*
*-- tool, so change it back:*
*send* "choose browse tool" to me in 10 milliseconds
*return* it
*end* RGBFromColorName
--
Regards,
Howard Bornstein
-----------------------
www.designeq.com
On Tue, Jan 8, 2013 at 5:24 PM, Peter Haworth <pete at lcsql.com> wrote:
> I have a need to convert a color name form LC's colornames property to its
> equivalent hex value, or rgb value. Can that be done in LC?
> Pete
> lcSQL Software <http://www.lcsql.com>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list