Make use of CWUTILS to create a simple Clarion to HTML color procedure


#1

Heres something I needed today that was not already in my toolkit!

ToHtmlColor            PROCEDURE(LONG pClarionColor) !,STRING
r BYTE
g BYTE
b BYTE
  CODE
  ColorToRGB(pClarionColor, r, g, b)
  RETURN '#' & ByteToHex(r) & ByteToHex(g) & ByteToHex(b)

Note that I am prefixing this with “#” but not adding “;” on the end. This may or may not be what you are after so salt to taste.

As long as you include the CWUTILS.INC somewhere this should do the job!

  MAP
    INCLUDE('CWUTIL.INC'),ONCE
  END