Parameters
Color specification. Can be created in multiple ways:
- RGB objects:
{ r: number; g?: number; b?: number; a?: number }or{ red?: number; green?: number; blue?: number; alpha?: number } - HSB objects:
{ h: number; s?: number; b?: number; a?: number }or{ hue?: number; saturation?: number; brightness?: number; alpha?: number } - Named colors: String literals like “red”, “blue”, “green”, etc.
- Semantic colors: String literals like “primary”, “secondary”, “accent”, etc.
- Hex strings: Format like “#FF5500”
- Numeric ARGB: Number values interpreted as ARGB integers
Support
Methods
opacity()
Returns a new color with the specified opacity level.Opacity value between 0 (fully transparent) and 1 (fully opaque).
Usage
Named colors
ComposeJS supports a full range of standard color names:Semantic colors
Use semantic colors to automatically adapt to the current theme:Hex colors
Create colors using hexadecimal color codes:RGB colors
Create colors using RGB values (0-255 for each channel):HSB colors
Create colors using Hue, Saturation, and Brightness values:Numeric ARGB colors
Create colors using 32-bit ARGB integer values:Color with opacity
Adjust the opacity of any color using the.opacity() method:
