API Documentation

for 0.0.1
Show:

Color Class

Represents a RGB color to be used in materials applied on Meshes.

This class extends the one from Three.js, API available here : http://threejs.org/docs/#Reference/Math/Color

Methods

add

(
  • color
)

Parameters:

Returns:

Color

addColors

(
  • color1
  • color2
)

Parameters:

Returns:

Color

addScalar

(
  • s
)

Parameters:

  • s Number

Returns:

Color

clone

()

Returns:

Color

convertGammaToLinear

()

Returns:

Color

convertLinearToGamma

()

Returns:

Color

copy

(
  • color
)

Copies given color.

Parameters:

Returns:

Color

copyGammaToLinear

(
  • color
)

Copies given color making conversion from gamma to linear space.

Parameters:

Returns:

Color

copyLinearToGamma

(
  • color
)

Copies given color making conversion from linear to gamma space.

Parameters:

Returns:

Color

Create

(
  • r
  • g
  • b
)
static

Creates a color based on [0;1] float RGB values

Parameters:

  • r Number

    The red component [0;1].

  • g Number

    The green component [0;1].

  • b Number

    The blue component [0;1].

equals

(
  • c
)

Parameters:

Returns:

Color

getHex

()

Returns:

Integer

getHexString

()

Returns:

String

getStyle

()

Returns:

String

lerp

(
  • color
)

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.

Parameters:

Returns:

Color

makeRGBAStringWithAlpha

(
  • a
)
String

Build a HTML color string with the given alpha.

Parameters:

  • a Number

    The alpha component [0;255].

Returns:

String:

a string representation of the color with alpha

multiply

(
  • color
)

Parameters:

Returns:

Color

multiplyScalar

(
  • s
)

Parameters:

  • s Number

Returns:

Color

offsetHSL

(
  • h
  • s
  • l
)

Parameters:

  • h Float
  • s Float
  • l Float

Returns:

Color

random

() Color static

Creates a random color

Returns:

Color:

the created random color

setHex

(
  • hex
)

Sets this color from a hexadecimal value.

Parameters:

  • hex Integer

Returns:

Color

setHSL

(
  • h
  • s
  • l
)

Sets color from hsl

Parameters:

  • h Float
  • s Float
  • l Float

Returns:

Color

setRGB

(
  • r
  • g
  • b
)

Sets this color from RGB values.

Parameters:

  • r Float
  • g Float
  • b Float

Returns:

Color

setRGB32

(
  • r
  • g
  • b
)

Creates a color based on [0;255] RGB values

Parameters:

  • r Number

    The red component [0;255].

  • g Number

    The green component [0;255].

  • b Number

    The blue component [0;255].

setStyle

(
  • style
)

Sets this color from a CSS-style string. For example, "rgb(250, 0,0)", "rgb(100%, 0%, 0%)", "hsl(0, 100%, 50%)", "#ff0000", "#f00", or "red". Transluent colors such as "rgba(255, 0, 0, 0.5)" and "hsla(0, 100%, 50%, 0.5)" are also accepted, but the alpha-channel coordinate will be discarded.

Parameters:

  • style String

Returns:

Color

setTo

(
  • val
)
Color private chainable

Sets the rgb components of this color to the [0;1] based given value

Parameters:

  • val Float

    float number

Returns:

Color:

this color with the given value

toArray

(
  • array
)

Returns an array [r,g,b

Parameters:

  • array Array

Returns:

Array

Properties

black

Color static

Color.black, a black Color Object

blue

Color static

Color.blue, a blue Color Object

cyan

Color static

Color.cyan, a cyan Color Object

darkGray

Color static

Color.darkGray, a darkGray Color Object

gray

Color static

Color.gray, a gray Color Object

green

Color static

Color.green, a green Color Object

lightBlue

Color static

Color.lightBlue, a lightBlue Color Object

lightGray

Color static

Color.lightGray, a lightGray Color Object

lightGreen

Color static

Color.lightGreen, a lightGreen Color Object

lightRed

Color static

Color.lightRed, a lightRed Color Object

magenta

Color static

Color.magenta, a magenta Color Object

red

Color static

Color.red, a red Color Object

transparent

Color static

Color.transparent, a transparent Color Object

white

Color static

Color.white, a white Color Object

yellow

Color static

Color.yellow, a yellow Color Object