B4J Question Text colour [Solved]

Roger Daley

Well-Known Member
Licensed User
Longtime User
Hi All,

I am attempting to port a B4A APP to B4J and I am having trouble with text colour in views.

With Buttons and labels I can set the colour in the designer by entering #FF0D88BF as the colour. This produces the correct Blue colour.

With text fields setting the colour in CSS as :
-fx-padding: 0; -fx-background-color:transparent; -fx-text-fill: #FF0D88BF; -fx-alignment: center-right;
I get a Pink text.

If I change the text colour of a button programmatically:
BtnMetric.Style = "-fx-text-fill: #FF0D88BF;-fx-background-color:transparent;"
I get the same Pink coloured text.

If I change the text colour of a button programmatically:
BtnMetric.Style = "-fx-text-fill: Blue;-fx-background-color:transparent;"
I get blue text, but not the required blue.

Any suggestions gratefully appreciated.

Regards Roger
 

Daestrum

Expert
Licensed User
Longtime User
Have you checked if the values are ARGB or RGBA
In your first example #FF0D88BF gives pink but #0D88BFFF gives blue, the alpha is being read as the red value in the first value.

I think -fx-text-fill only reads RGB values(no alpha) so #0D88BF would give you the colour you wanted.
 
Last edited:
Upvote 0
Top