How do I find the rgb values for colors defined by their name: e.g. blue, green, yellow etc.

Peter Haworth pete at lcsql.com
Mon Dec 9 20:10:19 EST 2013


Hi Jim,
Sent this earlier but it didn't make it for some reason.  This is a
function that some kind person on the list gave me a while back:

*function* RGBFromColorName theColor
*   if* theColor is not a color *then* *return* "Error: not a color"

   *create* invisible button

   *if* the result is not empty *then* *return* "Error"

   *set* the backgroundColor of last button to theColor

   *set* the backgroundPixel of last button to the backgroundPixel of last
button

   *get* the backgroundColor of last button

   *delete* last button

   *return* it

   *end* RGBFromColorName

Pete
lcSQL Software <http://www.lcsql.com>


On Mon, Dec 9, 2013 at 4:43 PM, James Hurley <jhurley0305 at sbcglobal.net>wrote:

> But Keven ,
>
> if the set is “blue”
> then the Put is “blue”
>
> How can for the Put into rgb?
>
> Jim
>
> n Dec 9, 2013, at 4:30 PM, James Hurley wrote:
>
> > The subject says it all.
>
> Jim,
>
> I think the only option is to set one of the color properties of an object
> to a named color, then examine the value of that property.
>
> set the backgroundColor of grc "foo" to aquamarine
> put the backgroundColor of grc "foo"
>
> Devin
>
> Devin Asay
> Learn to code with LiveCode University
> http://university.livecode.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