Equivalence of Color names to RGB

MisterX b.xavier at internet.lu
Sun Jul 4 00:50:58 EDT 2004


Dar, 

That's interesting! Here's what i wrote up some time ago

-- LUT = lookupTable
local rclut,rgblut
on generateLUTs
put the colornames into colorslist
repeat for each line c in colorslist
  set the backcolor of btn 1 to c
  get the backcolor of btn 1
  put it into clut[c]
  put c&tab&it & cr after rgblut
end repeat

-- to retrieve the colors:
-- color to rgb
put clut["silver"] into anrbg
-- or rgb to color
set itemdelimiter to tab 
put item 2 of line lineoffset(anrgb,rgblut) into nametorgb

> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com
> [mailto:use-revolution-bounces at lists.runrev.com]On Behalf Of Dar Scott
> Sent: Sunday, July 04, 2004 05:31
> To: How to use Revolution
> Subject: Re: Equivalence of Color names to RGB
> 
> 
> 
> On Jul 3, 2004, at 9:01 PM, Alejandro Tejada wrote:
> 
> > How could i convert the color names to their
> > equivalent rgb triplet?
> 
> There is probably a better way, but this might work:
> 
> Go through colorNames().  For each name, do this:  set the back color 
> of a rectangle to that color.  Import a snapshot of the rectangle to an 
> image.  Get the imageData.  Find an interior pixel and then convert the 
> bytes to rgb triplet.
> 
> Dar Scott
> 
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution


More information about the use-livecode mailing list