Roger Daley Well-Known Member Licensed User Longtime User Jul 30, 2016 #1 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
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 Jul 30, 2016 #2 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: Jul 30, 2016 Upvote 0
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.
Roger Daley Well-Known Member Licensed User Longtime User Jul 30, 2016 #3 Thanks Daestrum, You picked it in one. Using RGB only, works. Regards Roger Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jul 31, 2016 #4 Note that you shouldn't set the Style property directly. Use CSSUtils instead. Upvote 0
Roger Daley Well-Known Member Licensed User Longtime User Jul 31, 2016 #5 Erel said: Note that you shouldn't set the Style property directly. Use CSSUtils instead. Click to expand... Erel, Can you please point me to an example. Roger Upvote 0
Erel said: Note that you shouldn't set the Style property directly. Use CSSUtils instead. Click to expand... Erel, Can you please point me to an example. Roger
Roger Daley Well-Known Member Licensed User Longtime User Jul 31, 2016 #6 Erel said: Note that you shouldn't set the Style property directly. Use CSSUtils instead. Click to expand... Don't worry I've found it. Thanks Roger Upvote 0
Erel said: Note that you shouldn't set the Style property directly. Use CSSUtils instead. Click to expand... Don't worry I've found it. Thanks Roger