Is it possible to set the color of a component such as a button from a value in database?

I tried setting the background color of a button to a reference to a field in database which is a hex string like this #000000 and it wouldn’t work. I wonder if there is some other way.

normally, it should have worked, Another way, is that if you have two colors, you can just store an integer value assigned to a color code and use the is_equal function, you can show a color based on the integer value from the backend