Color

THREE.Color
See theColor companion object
class Color(var r: UndefOr[Double | String | Color], var g: UndefOr[Double], var b: UndefOr[Double]) extends Object

A class representing an RGB color.

A Color instance is represented by RGB components in the linear working color space, which defaults to LinearSRGBColorSpace. Inputs conventionally using SRGBColorSpace (such as hexadecimals and CSS strings) are converted to the working color space automatically.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Any
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def add(color: Color): this.type

Adds the RGB values of the given color to the RGB values of this color

Adds the RGB values of the given color to the RGB values of this color

Attributes

def addColors(color1: Color, color2: Color): this.type

Adds the RGB values of the given colors and stores the result in this instance

Adds the RGB values of the given colors and stores the result in this instance

Attributes

def addScalar(s: Double): this.type

Adds the given scalar value to the RGB values of this color

Adds the given scalar value to the RGB values of this color

Attributes

def applyMatrix3(m: Matrix3): this.type

Transforms this color with the given 3x3 matrix

Transforms this color with the given 3x3 matrix

Attributes

def convertLinearToSRGB(): this.type

Converts this color from Linear to SRGB color space

Converts this color from Linear to SRGB color space

Attributes

def convertSRGBToLinear(): this.type

Converts this color from SRGB to Linear color space

Converts this color from SRGB to Linear color space

Attributes

def copy(color: Color): this.type

Copies the values of the given color to this instance

Copies the values of the given color to this instance

Attributes

def copyLinearToSRGB(color: Color): this.type

Copies given color into this color, and converts from Linear to SRGB color space

Copies given color into this color, and converts from Linear to SRGB color space

Attributes

def copySRGBToLinear(color: Color): this.type

Copies given color into this color, and converts from SRGB to Linear color space

Copies given color into this color, and converts from SRGB to Linear color space

Attributes

def equals(c: Color): Boolean

Returns true if this color equals the given one

Returns true if this color equals the given one

Attributes

def fromArray(array: Array[Double], offset: Double): this.type

Sets this color's RGB components from the given array

Sets this color's RGB components from the given array

Attributes

def fromBufferAttribute(attribute: Object, index: Int): this.type

Sets the components of this color from the given buffer attribute

Sets the components of this color from the given buffer attribute

Attributes

def getHSL(target: Object, colorSpace: UndefOr[String]): Object

Converts the colors RGB values into the HSL format and stores them into the given target object

Converts the colors RGB values into the HSL format and stores them into the given target object

Attributes

def getHex(colorSpace: UndefOr[String]): Double

Returns the hexadecimal value of this color

Returns the hexadecimal value of this color

Attributes

def getHexString(colorSpace: UndefOr[String]): String

Returns the hexadecimal value of this color as a string

Returns the hexadecimal value of this color as a string

Attributes

def getRGB(target: Color, colorSpace: UndefOr[String]): Color

Returns the RGB values of this color and stores them into the given target object

Returns the RGB values of this color and stores them into the given target object

Attributes

def getStyle(colorSpace: UndefOr[String]): String

Returns the value of this color as a CSS style string

Returns the value of this color as a CSS style string

Attributes

def jsClone(): Color

Returns a new color with copied values from this instance

Returns a new color with copied values from this instance

Attributes

def lerp(color: Color, alpha: Double): this.type

Linearly interpolates this color's RGB values toward the RGB values of the given color

Linearly interpolates this color's RGB values toward the RGB values of the given color

Attributes

def lerpColors(color1: Color, color2: Color, alpha: Double): this.type

Linearly interpolates between the given colors and stores the result in this instance

Linearly interpolates between the given colors and stores the result in this instance

Attributes

def lerpHSL(color: Color, alpha: Double): this.type

Linearly interpolates this color's HSL values toward the HSL values of the given color

Linearly interpolates this color's HSL values toward the HSL values of the given color

Attributes

def multiply(color: Color): this.type

Multiplies the RGB values of the given color with the RGB values of this color

Multiplies the RGB values of the given color with the RGB values of this color

Attributes

def multiplyScalar(s: Double): this.type

Multiplies the given scalar value with the RGB values of this color

Multiplies the given scalar value with the RGB values of this color

Attributes

def offsetHSL(h: Double, s: Double, l: Double): this.type

Adds the given HSL values to this color's values

Adds the given HSL values to this color's values

Attributes

def set(r: Double | String | Color, g: UndefOr[Double], b: UndefOr[Double]): this.type

Sets the color's components from the given values

Sets the color's components from the given values

Attributes

def setColorName(style: String, colorSpace: UndefOr[String]): this.type

Sets this color from a color name

Sets this color from a color name

Attributes

def setFromVector3(v: Vector3): this.type

Sets the color's RGB components from the given 3D vector

Sets the color's RGB components from the given 3D vector

Attributes

def setHSL(h: Double, s: Double, l: Double, colorSpace: UndefOr[String]): this.type

Sets this color from HSL values

Sets this color from HSL values

Attributes

def setHex(hex: Double, colorSpace: UndefOr[String]): this.type

Sets this color from a hexadecimal value

Sets this color from a hexadecimal value

Attributes

def setRGB(r: Double, g: Double, b: Double, colorSpace: UndefOr[String]): this.type

Sets this color from RGB values

Sets this color from RGB values

Attributes

def setScalar(scalar: Double): this.type

Sets the color's components to the given scalar value

Sets the color's components to the given scalar value

Attributes

def setStyle(style: String, colorSpace: UndefOr[String]): this.type

Sets this color from a CSS-style string

Sets this color from a CSS-style string

Attributes

def sub(color: Color): this.type

Subtracts the RGB values of the given color from the RGB values of this color

Subtracts the RGB values of the given color from the RGB values of this color

Attributes

def toArray(array: Array[Double], offset: Double): Array[Double]

Returns the RGB components as an array

Returns the RGB components as an array

Attributes

def toJSON(): Double

Returns the hexadecimal value (serialization result)

Returns the hexadecimal value (serialization result)

Attributes

Inherited methods

def hasOwnProperty(v: String): Boolean

Attributes

Inherited from:
Object
def isPrototypeOf(v: Object): Boolean

Attributes

Inherited from:
Object
def propertyIsEnumerable(v: String): Boolean

Attributes

Inherited from:
Object
def toLocaleString(): String

Attributes

Inherited from:
Object
def valueOf(): Any

Attributes

Inherited from:
Object

Concrete fields

var b: UndefOr[Double]
var g: UndefOr[Double]
val isColor: Boolean

Flag for type testing

Flag for type testing

Attributes

var r: UndefOr[Double | String | Color]