[name]
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
[name]( 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
.[page:Float r]
Red channel value between 0 and 1. Default is 1.
.[page:Float g]
Green channel value between 0 and 1. Default is 1.
.[page:Float b]
Blue channel value between 0 and 1. Default is 1.
Methods
.copy( [page:Color color] ) [page:this]
color — Color to copy.
Copies given color.
.copyGammaToLinear( [page:Color color] ) [page:this]
color — Color to copy.
Copies given color making conversion from gamma to linear space.
.copyLinearToGamma( [page:Color color] ) [page:this]
color — Color to copy.
Copies given color making conversion from linear to gamma space.
.convertGammaToLinear() [page:this]
Converts this color from gamma to linear space.
.convertLinearToGamma() [page:this]
Converts this color from linear to gamma space.
.setRGB( [page:Float r], [page:Float g], [page:Float b] ) [page: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.
.getHex() [page:Integer]
Returns the hexadecimal value of this color.
.getHexString() [page:String]
Returns the string formated hexadecimal value of this color.
.setHex( [page:Integer hex] ) [page:this]
hex — Color in hexadecimal.
Sets this color from a hexadecimal value.
.setStyle( [page:String style] ) [page:this]
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.
.getStyle() [page:String]
Returns the value of this color as a CSS-style string. Example: rgb(255,0,0)
.setHSL( [page:Float h], [page:Float s], [page:Float l] ) [page: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() [page:Object hsl]
Returns an object with properties h, s, and l.
.offsetHSL( [page:Float h], [page:Float s], [page:Float l] ) [page:this]
Adds given h, s, and l to this color's existing h, s, and l values.
.add ( [page:Color color] ) [page:this]
Adds rgb values of given color to rgb values of this color
.addColors( [page:Color color1], [page:Color color2] ) [page:this]
Sets this color to the sum of color1 and color2
.addScalar( [page:Number s] ) [page:this]
Adds s to the rgb values of this color
.multiply( [page:Color color] ) [page:this]
Multiplies this color's rgb values by given color's rgb values
.multiplyScalar( [page:Number s] ) [page:this]
Multiplies this color's rgb values by s
.lerp( [page:Color color], alpha ) [page:this]
todo
.equals( [page:Color c] ) [page:this]
Compares this color and c and returns true if they are the same, false otherwise.
.clone() [page:Color]
Clones this color.
.set([page:todo value]) [page:todo]
value -- todo
todo
Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]