New version:

http://mathewson.110mb.com/FILEZ/COLORNAMER.rev.zip

now showing RGB, HSV and HSL

actually the code is dead easy once you can cope with all the brackets:

used this in a listField full of colorNames:

on mouseDown
 get the clickText
 put the clickText into fld "SELECT"
 set the backgroundColor of fld "KNAMES" to the clickText
 set the backgroundColor of grc "SAMPLE" to the clickText
end mouseDown
on mouseUp
 put "RGB  " & the mouseColor into fld "fRGB"
 put the mouseColor into FRGB
 put item 1 of FRGB into ARR
 put item 2 of FRGB into GEE
 put item 3 of FRGB into BEE
 put max(FRGB) into maxRGB
 put min(FRGB) into minRGB
 if maxRGB = minRGB then
   put 0 into ACHE
   else
         if maxRGB = ARR then
put ((60 * ((GEE - BEE) / (maxRGB - minRGB)) + 360) mod 360) into ACHE
        end if
        if maxRGB = GEE then
            put (60 * ((BEE - ARR) / (maxRGB - minRGB)) + 120) into ACHE
        end if
        if maxRGB = BEE then
           put (60 * ((ARR - GEE) / (maxRGB - minRGB)) + 240) into ACHE
        end if
      end if
      if maxRGB = minRGB then
        put 0 into ESS
      else
        put (0.5 * (maxRGB + minRGB)) into ELL
        if ELL <= 0.5 then
          put ((maxRGB - minRGB) / (maxRGb + minRGB)) into ESS
        end if
        if ELL > 0.5 then
          put ((maxRGB - minRGB) / (2 - (maxRGb + minRGB))) into ESS
        end if
      end if
      put maxRGB into VEE
      put "HSV  " & ACHE & "," & ESS & "," & VEE into fld "fHSV"
      put "HSL  " & ACHE & "," & ESS & "," & ELL into fld "fHSL"
 set the backgroundColor of fld "KNAMES" to WHITE
end mouseUp

love Richmond.
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to