Es una función que hace lo que buscas.
Puedes usarla en un prg o en un procedimiento a nivel de formulario.
FUNCTION RGBcolor
LPARAMETERS tnDec
lcHex = ""
lnFactor = 24 && establecer un valor del factor de exponente mayor que
FOR lnPos = 6 TO 1 STEP -1
lnFactor = lnFactor - 4 && disminuir factorial
lnExp = 2 ^ lnFactor && extrapolar el poder al lado de dos
FOR lnOrd = 15 TO 1 STEP -1
IF tnDec < lnExp && no value greater than current one,
lcHex = lcHex + "0" && so store a zero in this position
EXIT && go back for the next value
ENDIF
IF tnDec >= lnExp * lnOrd && is value greater than or equal to?
* find the matching hex value from its ordinal position
lcHex = lcHex + SUBSTR('123456789ABCDEF', lnOrd, 1)
EXIT
ENDIF
ENDFOR
tnDec = tnDec % lnExp && leave remainder of exponential division
ENDFOR
* reverse the order of the individual color indicators
lcHex = RIGHT(lcHex, 2) + SUBSTR(lcHex, 3, 2) + LEFT(lcHex, 2)
* convert the pairs into decimal values
lnPick = 2 && offset to determine which pair to convert
lcRGB = "" && start of string delineator
* parse each color indicator and convert to decimal
FOR lnColor = 1 TO 3
lcHue = SUBSTR(lcHex, (lnPick * lnColor) - 1, 2) && pull out color
lnMSB = ASC(LEFT(lcHue, 1)) && "Most Significant Bit"
lnLSB = ASC(RIGHT(lcHue, 1)) && "Least Significant Bit"
* subtract appropriate value from each to get decimal equivalent
lnMSB = lnMSB - IIF(lnMSB > 57, 55, 48)
lnLSB = lnLSB - IIF(lnLSB > 57, 55, 48)
* then add decimals together
lcRGB = lcRGB + TRANSFORM( lnMSB * 16 + lnLSB, '999') + ","
ENDFOR
lcRGB = LEFT(lcRGB, LEN(lcRGB) - 1)
Red=VAL(LEFT(lcRGB,ATC(",",lcRGB,1)-1))
Green=VAL(SUBSTR(lcRGB,ATC(",",lcRGB,1)+1,ATC(",",lcRGB,1)-1))
Blue=VAL(SUBSTR(lcRGB,ATC(",",lcRGB,2)+1,ATC(",",lcRGB,1)-1))
CRGB=RGB(Red,Green,Blue)
RETURN CRGB
ENDFUNC
Saludos.