Returns the RGB color as an array.
An array containing the red, green, blue, and alpha components.
Returns the RGB color as a hexadecimal string.
A string representation of the RGB color in hexadecimal format.
Returns the RGB color as a string.
A string representation of the RGB color in either rgb or rgba format.
Linearly shifts each channel toward black (negative value) or white (positive value).
Brightness shift. Clamped to [-1, 1]. 0 is identity; -1 yields pure black; +1 yields pure white.
A new RGB color with adjusted brightness.
Scales each channel around the midpoint 127.5: c → (c − 127.5) · value + 127.5,
clamped to [0, 255].
Contrast multiplier. Clamped to [0, 1e6]. 1 is identity; 0 collapses the color to mid-gray (#808080); values >1 increase contrast; very large values push each channel to 0 or 255.
A new RGB color with adjusted contrast.
Multiplies each channel by (1 − ratio). Mathematically equivalent to blend(ratio, black).
Note: this operation is theme-absolute — under luminosity inversion it still moves toward black.
For inversion-safe rules use blend(ratio, fg) where fg is your style's foreground/contrast reference.
Darkening ratio. Range: [0, 1] (per-channel result is clamped to [0, 255]). 0 is identity; 1 yields pure black.
A new RGB color, darkened.
Reduces the alpha proportionally: a → a · (1 − value).
Fade amount. Range: [0, 1]. 0 is identity; 1 yields fully transparent.
A new RGB color with reduced alpha.
Applies a per-channel gamma correction: c → 255 · (c/255)^value.
Gamma exponent. Clamped to [1e-3, 1e3]. 1 is identity; <1 brightens midtones; >1 darkens midtones.
A new RGB color with gamma correction applied.
Inverts each RGB channel: c → 255 − c. The hue is also flipped.
For a hue-preserving "dark mode" inversion, use invertLuminosity instead.
A new RGB color with all channels inverted.
Returns a new color with the HSL lightness flipped (L → 100 − L). Hue and saturation are preserved, so a light cream becomes a dark cream of the same hue. Useful for deriving a dark-theme palette from a light-theme palette.
A new HSL color with the lightness inverted.
Blends each channel toward white. Mathematically equivalent to blend(ratio, white).
Note: this operation is theme-absolute — under luminosity inversion it still moves toward white.
For inversion-safe rules use blend(ratio, bg) where bg is your style's background reference.
Lightening ratio. Range: [0, 1] (per-channel result is clamped to [0, 255]). 0 is identity; 1 yields pure white.
A new RGB color, lightened.
Rotates the hue around the color wheel.
Rotation in degrees. Any number is accepted and reduced modulo 360. 0 leaves the hue unchanged; 180 yields the complementary hue.
A new HSL color with the rotated hue.
Rounds the RGB color components to the nearest integer.
A new RGB instance with rounded color values.
Scales the HSL saturation by (1 + ratio), then clamps to [0, 100].
Saturation change ratio. Range: [-1, ∞). -1 fully desaturates (gray); 0 is identity; 1 doubles saturation; values that would push S past 100 are clamped.
A new HSL color with adjusted saturation.
Replaces the hue, preserving saturation and value.
Hue in degrees. Any number; reduced modulo 360.
A new HSV color with the new hue.
Shifts the hue toward tintColor's hue, blending in RGB space.
Internally: derives a version of this color carrying tintColor's hue, then linearly interpolates
between this and that variant by value.
Tint amount. Clamped to [0, 1].
0 is identity; 1 yields this color's luminosity/saturation but with tintColor's hue.
Color whose hue is used for tinting; only its hue matters.
A new RGB color, tinted.
Represents an RGB color with optional alpha transparency.