[name]
Represents a color. See also [page:ColorUtils].
Example
var color = new THREE.Color( 0xff0000 );
Constructor
[name]( [page:Integer hex])
hex — initial color in hexadecimal
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.
.setHSV( [page:Float h], [page:Float s], [page:Float v] ) [page:this]
h — Hue channel value between 0 and 1.
s — Saturation value channel between 0 and 1.
v — Value channel value between 0 and 1.
Sets this color from HSV values.
Based on MochiKit implementation by Bob Ippolito.
.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.
.getContextStyle() [page:String]
Returns the value of this color in CSS context style.
Example: rgb(r, g, b)
.setContextStyle( [page:String contextStyle] ) [page:this]
contextStyle — Color in CSS context style format.
Sets this color from a CSS context style string.
.clone() [page:Color]
Clones this color.
Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]