For example, the orange color is RGB(255, 69, 0) or #FF4500.
How can I recalculate the RGB value to #FF4500?
For example, the orange color is RGB(255, 69, 0) or #FF4500.
How can I recalculate the RGB value to #FF4500?
function Main()
? RGBToHex( 255, 69, 0 )
return nil
function RGBToHex( nRed, nGreen, nBlue )
return "#" + PadL( hb_NumToHex( nRed ), 2, "0" ) + ;
PadL( hb_NumToHex( nGreen ), 2, "0" ) + ;
PadL( hb_NumToHex( nBlue ), 2, "0" )Thanks, I got it !
RGB( 255, 69, 0 ) returns the number 17919. Is it possible to convert this number 17919 to #FF4500 ?
Or get the values Red, Green, Blue from 17919 ?
FUNCTION NumToColor( nNum )
LOCAL cBuf
cBuf := PadL( hb_NumToHex( nAnd( nNum, 255 ) ), 2, "0" )
nNum := INT( nNum / 256 )
cBuf += PadL( hb_NumToHex( nAnd( nNum, 255 ) ), 2, "0" )
nNum := INT( nNum / 256 )
cBuf += PadL( hb_NumToHex( nAnd( nNum, 255 ) ), 2, "0" )
RETURN "#" + cBuf'#'+numtohex(nRGBRed(num),2)+numtohex(nRGBGreen(num),2)+numtohex(nRGBBlue(num),2)