### CSSUtils to set CSS attributes

The CSSUtils library makes it easy to update CSS properties at runtime.
Important
Always use CSSUtils to set CSS attributes.
Otherwise the attributes set by the designer are overwritten.
Example
Instead of
textfield.Style = $"-fx-focus-color: transparent;"$
use
CSSUtils.SetStyleProperty(textfield, "-fx-focus-color", "transparent")
Example Styling a Label
Private Label1 As Label
Label1.Text = "Hello World"
CSSUtils.SetStyleProperty(Label1, "-fx-text-fill", "blue")
CSSUtils.SetBorder(Label1, 2, fx.Colors.Red, 2)
CSSUtils.SetStyleProperty(Label1, "-fx-font-size", "32")
Log($"CSSUtils library GetStyleProperty for Label=${CSSUtils.GetStyleProperty(Label1, "-fx-font-size")}"$)
Example Styling a Button
Private btnStart as Button
'Set the text color
CSSUtils.SetStyleProperty(btnStart, "-fx-text-fill", "blue")
'Set the background color
CSSUtils.SetStyleProperty(btnStart, "-fx-background-color", "white")
Handle Wrong Token specified
If f.e. a wrong token is given, then error message like Program started.
WARNING: CSS Error parsing '*{-fx-border-color:#000000;-fx-border-width:0,00;-fx-text-fill:blue;-fx-text-size:32dip;}: Unexpected token '32dip' at [2,55]
Try
CSSUtils.SetStyleProperty(Label1, "-fx-text-fill", "redx")
Catch
Log(LastException)
End Try

Changed: , Category: CSS, File: T6C177M1286.htm, ID: 1286