Need Color Conversion Function
Need Color Conversion Function
Hi All
Anybody with a function to convert Xbase++ color code to HEX such as $00FFFFDC
Thanks
Joe
Anybody with a function to convert Xbase++ color code to HEX such as $00FFFFDC
Thanks
Joe
Re: Need Color Conversion Function
you can use RGB Value and cByte2Hex() (ot4xb) or StrToHex() (Tools)unixkd wrote:Anybody with a function to convert Xbase++ color code to HEX such as $00FFFFDC
Code: Select all
FUNCTION Color2Hex(xValue)
LOCAL cHex := "0x"
LOCAL aColor := {0,0,0}
DO CASE
CASE VALTYPE(xValue) = "A"
cHex += cByte2Hex(xValue[3])+;
cByte2Hex(xValue[2])+;
cByte2Hex(xValue[1])
CASE VALTYPE(xValue) = "N"
aColor := GraGetRGBIntensity(xValue)
IF aColor <> NIL
cHex += cByte2Hex(aColor[3])+;
cByte2Hex(aColor[2])+;
cByte2Hex(aColor[1])
ENDIF
ENDCASE
RETURN cHex
greetings by OHR
Jimmy
Jimmy
Re: Need Color Conversion Function
Hi Jimmy
I used StrToHex() and passed { 0, 127, 127 } which is dark cyan it returned 0x any thing value returned 0x
Thanks.
I used StrToHex() and passed { 0, 127, 127 } which is dark cyan it returned 0x any thing value returned 0x
Thanks.
Re: Need Color Conversion Function
What I need is RGB to HTML color code conversion like { 0, 127, 127 } to something like $00FFFFDC
Thanks.
Thanks.
Re: Need Color Conversion Function
have not try StrToHex() (Tools) but it work for me with cByte2Hex() (ot4xb) as i show i Code above.unixkd wrote:I used StrToHex() and passed { 0, 127, 127 } which is dark cyan it returned 0x any thing value returned 0x
these HEX Color are for Windows Controls ... not sure about HTML Color
greetings by OHR
Jimmy
Jimmy
Re: Need Color Conversion Function
Did you pass the array to that function? That won't work, you have to pass the separate values.
Re: Need Color Conversion Function
How ??skiman wrote:Did you pass the array to that function? That won't work, you have to pass the separate values.
Look at the function properly, it expects an array as para.
Thanks.
Re: Need Color Conversion Function
Hi Jimmy
I downloaded the latest ot4xb.dll but no ot4xb.lib only ot4xb_cpp.lib
Thanks
I downloaded the latest ot4xb.dll but no ot4xb.lib only ot4xb_cpp.lib
Thanks
Re: Need Color Conversion Function
Try DC_XbpToHtmlColor( <aColor> ) where <aColor> is an array of 3 RGB values.
The eXpress train is coming - and it has more cars.
Re: Need Color Conversion Function
Hi Roger
DC_XbpToHtmlColor() only work for certain pre-defined colors returned by _NumColorToHtmlColor(aColor) in _dchtml.prg. I need a generic function that will work for ANY RGB colors.
Thanks.
Joe
DC_XbpToHtmlColor() only work for certain pre-defined colors returned by _NumColorToHtmlColor(aColor) in _dchtml.prg. I need a generic function that will work for ANY RGB colors.
Thanks.
Joe