Perspective text field background color

I should be missing somthing…

I want to change the background color of a text field. I enter a color in the props editor but it does not change on the component. I’m doing the same with a label and it works fine.


What version of Perspective are you using?
What color are you supplying?

Version is 8.0.12.

It seems I cannot the expression color(R,G,B) is not working. I must use a color like #FFFFFF.

Correct, you may not use the Color expression, because that actually returns a java.awt.Color object, whereas Perspective (actually, CSS) will expect a string. You’re not even able to use the toString expression on the Color expression because it still returns as something like color(R, G, B, A), which won’t work. I was able to get the following to work, but it’s really more effort than you probably want to put into this:

replace(toStr(color(0,255,0)), "color", "rgb")

You’d be better off creating your own project script to create a color based off of values and return a proper hex color.

You can also just use the css builtin rgb directly as a property value.