Display a field based on a hex color value

I have a field CHAR field which contains an HTML HEX color value.
On a grid, I am able to display the actual color of the HEX value, as shown in the attached sample. by using the following code in OnRecord
$colr = {colorHtml};
$fontColr = “#ffffff”;
sc_set_global($colr);
sc_set_global($fontcolr);
sc_field_style({swatch}, [colr], ‘15px’,[fontColr],‘Arial, sans-serif’, ‘bold’);

I want to do this on a form as well, but neither support now I know how.

Anyone know how, possibly with CSS?

Lewis

I am looking for the same. So far no luck :frowning:
I have EditableGrid Form and need to show color based on HEX stored in the field.

Hi. I usually use a grid with a form to show the color.

Add in OnRecord event
[color]= {color};
sc_field_style({color}, [color]);

Hope this help.
Regards.

Thanks
I know how to do this in GRID App. The question was/is - how to do the same in a FORM ?
In my particular case “Editeble Grid Form”

no MACROS for this functionality and no embed hooks to allow to enter inline CSS (which really sucks).
All FORM CSS is basically static.
I think I have some some tricks to affect Form CSS , but it was more than a year ago and I cannot find it anymore