Search.../

foregroundColor

Sets or gets the foreground color of an element.

Description

The foreground color value is a string representing an rgba color in one of the following formats:

  • "red": One of 140 predefined color names.
  • "#FF0000": A hexadecimal rgb color value.
  • "rgb(255,0,0)": An rgb() function color value.
  • "#FF000000": A hexadecimal rgba color value.
  • "rgba(255,0,0,1.0)": An rgba() function color value.

This style can be used with the following elements:

Type:

stringRead & Write

Was this helpful?

Set the foreground color

Copy Code
1$w("#myElement").style.foregroundColor = "rgba(255,0,0,0.5)";
Get the foreground color

Copy Code
1let foregroundColor = $w("#myElement").style.foregroundColor;