Converting colour names: Hex & RGB colour values...

Chipp Walters chipp at chipp.com
Sun Jan 6 19:25:01 EST 2002


David, below is part of a script from my Color Picker utility. Hope it
helps.

-Chipp

on mouseDown
  put the mouseColor into thecolor

  set the numberFormat to "##"

  put formathex(baseConvert(item 1 of thecolor,10,16)) into R
  put formathex(baseConvert(item 2 of thecolor,10,16)) into G
  put formathex(baseConvert(item 3 of thecolor,10,16)) into B


  put thecolor into cd fld "rgb" of cd "stageLg" of stack "HemTools"
  put "#" & R & G & B into cd fld "hex" of cd "stageLg" of stack "HemTools"
  go to cd "stage" of stack "Hemtools"
  click at the loc of btn "Open Button"
  set the menuHistory of button "tabs" to 2

end mouseDown

function formathex thevalue
  if the length of thevalue is 1
  then put "0" before thevalue
  return thevalue
end formathex

-----Original Message-----
From: metacard-admin at lists.runrev.com
[mailto:metacard-admin at lists.runrev.com]On Behalf Of David Bovill
Sent: Sunday, January 06, 2002 4:30 PM
To: metacard at lists.runrev.com; use-revolution at lists.runrev.com
Subject: Converting colour names: Hex & RGB colour values...


There are three ways of specifying a colour: name, rgb, and htm hexcolour...

How do I convert between them? I was about to write a routing to convert rgb
to html colour values, and I couldn't get around the problem of the colour
functions returning colour names instead of rgb triplets - anyway I am sure
there must be a built in technique?

_______________________________________________
metacard mailing list
metacard at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/metacard




More information about the metacard mailing list