Color
A color represented by RGB components in the linear working color space, which defaults to ColorSpace.LinearSRGB. Inputs conventionally using ColorSpace.SRGB (such as hexadecimals) are converted to the working color space automatically. If ColorManagement.enabled is false, no conversions occur.
Colors are mutable and not thread-safe; confine an instance (and any object graph holding it) to a single thread, exactly as in three.js. Most methods mutate this and return it for chaining.
Iterating a color yields its components (r, g, b) in order.
Deferred CSS-string / named-color paths
three.js's setStyle (CSS-string parsing: rgb(), hsl(), #hex), the X11 setColorName lookup with its 140-entry _colorKeywords table, Color.NAMES, and getStyle (CSS-string output) are deferred: they require a large color name table and regex-based CSS parsing that add no value to the pure math layer yet. The numeric constructors (Color with r,g,b or a hex Int), setHex, setRGB and setHSL cover the algebraic paths.
Constructors
Constructs a white color (r = g = b = 1).
Constructs a color from the RGB components r, g, b (via setRGB, i.e. interpreted in the working color space).
Constructs a color from the hexadecimal value hex (via setHex, i.e. interpreted as ColorSpace.SRGB by default).
Constructs a color as a copy of color.
Properties
Functions
Transforms this color with the 3x3 matrix m.
Converts this color from ColorSpace.LinearSRGB to ColorSpace.SRGB.
Converts this color from ColorSpace.SRGB to ColorSpace.LinearSRGB.
Copies color into this color, then converts from ColorSpace.LinearSRGB to ColorSpace.SRGB.
Copies color into this color, then converts from ColorSpace.SRGB to ColorSpace.LinearSRGB.
Returns the hexadecimal value of this color (in colorSpace, default ColorSpace.SRGB).
Returns the hexadecimal value of this color as a 6-digit lowercase string (for example, "ffffff").
Multiplies this color's RGB values by the scalar s.
Sets this color's RGB components from the 3D vector v (r = x, g = y, b = z).
Sets this color from a hexadecimal value.