Color
Represents a color.
Example
var color = new THREE.Color();
var color = new THREE.Color( 0xff0000 );
var color = new THREE.Color("rgb(255,0,0)");
Constructor
Color( value )
value — optional argument that sets initial color. Can be a hexadecimal or a CSS-style string, for example, "rgb(250, 0,0)", "rgb(100%,0%,0%)", "#ff0000", "#f00", or "red"
Properties
Red channel value between 0 and 1. Default is 1.
Green channel value between 0 and 1. Default is 1.
Blue channel value between 0 and 1. Default is 1.
Methods
color — Color to copy.
Copies given color.
.copyGammaToLinear( color ) this
color — Color to copy.
Copies given color making conversion from gamma to linear space.
.copyLinearToGamma( color ) this
color — Color to copy.
Copies given color making conversion from linear to gamma space.
.convertGammaToLinear() this
Converts this color from gamma to linear space.
.convertLinearToGamma() this
Converts this color from linear to gamma space.
.setRGB( r, g, b ) this
r — Red channel value between 0 and 1.
g — Green channel value between 0 and 1.
b — Blue channel value between 0 and 1.
Sets this color from RGB values.
Returns the hexadecimal value of this color.
.getHexString() String
Returns the string formated hexadecimal value of this color.
hex — Color in hexadecimal.
Sets this color from a hexadecimal value.
style — color as a CSS-style string, for example, "rgb(250, 0,0)", "rgb(100%,0%,0%)", "#ff0000", "#f00", or "red"
Sets this color from a CSS-style string.
Returns the value of this color as a CSS-style string. Example: rgb(255,0,0)
.setHSL( h, s, l ) this
h — hue value between 0.0 and 1.0
s — saturation value between 0.0 and 1.0
l — lightness value between 0.0 and 1.0
Sets color from hsl
.getHSL() hsl
Returns an object with properties h, s, and l.
.offsetHSL( h, s, l ) this
Adds given h, s, and l to this color's existing h, s, and l values.
Adds rgb values of given color to rgb values of this color
Sets this color to the sum of color1 and color2
.addScalar( s ) this
Adds s to the rgb values of this color
Multiplies this color's rgb values by given color's rgb values
.multiplyScalar( s ) this
Multiplies this color's rgb values by s
alpha -- a number between 0 and 1.
Linear interpolation of this colors rgb values and the rgb values of the first argument. The alpha argument can be thought of as the percent between the two colors, where 0 is this color and 1 is the first argument.
.equals( c ) this
Compares this color and c and returns true if they are the same, false otherwise.
Clones this color.
.set( value ) this
Delegates to .copy, .setStyle, or .setHex depending on input type.
Source
src/math/Color.js
Edit this page