Dear Tom,
Greetings of the day
You can use conditional expressions inside elements' value as well as classes.
Example : Use a Variable to store value of HEX you receive from Database.
In the UI, use expression with style tag to give dynamic value.
Example in the image below :

If you are receiving #FFFFFF from DB then your dynamic style will be color:#FFFFFF at runtime.
If you are getting only FFFFFF from DB then you need to add style ="color:#" + HexReceivedFromDB
Let us know if this is something you are looking for ?
Regards,
Palak Patel