Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/remapper/src/deps.ts>three.Color

A framework for Beat Saber map scripting.
Go to Latest
class three.Color
Re-export
import { three } from "https://deno.land/x/remapper@2.1.0/src/deps.ts";
const { Color } = three;

Represents a color. See also ColorUtils.

see src/math/Color.js

Examples

const color = new THREE.Color( 0xff0000 );

Constructors

new
Color(color?: ColorRepresentation)
new
Color(
r: number,
g: number,
b: number,
)

Properties

b: number

Blue channel value between 0 and 1. Default is 1.

g: number

Green channel value between 0 and 1. Default is 1.

readonly
isColor: true
r: number

Red channel value between 0 and 1. Default is 1.

Methods

add(color: Color): this
addColors(color1: Color, color2: Color): this
addScalar(s: number): this
clone(): this

Clones this color.

Converts this color from linear to sRGB space.

Converts this color from sRGB to linear space.

copy(color: Color): this

Copies given color.

Copies given color making conversion from linear to sRGB space.

Copies given color making conversion from sRGB to linear space.

equals(color: Color): boolean
fromArray(array: number[] | ArrayLike<number>, offset?: number): this

Sets this color's red, green and blue value from the provided array or array-like.

fromBufferAttribute(attribute: BufferAttribute, index: number): this
getHex(colorSpace?: ColorSpace): number

Returns the hexadecimal value of this color.

getHexString(colorSpace?: ColorSpace): string

Returns the string formated hexadecimal value of this color.

getHSL(target: HSL, colorSpace?: ColorSpace): HSL
getRGB(target: RGB, colorSpace?: ColorSpace): RGB
getStyle(colorSpace?: ColorSpace): string

Returns the value of this color in CSS context style. Example: rgb(r, g, b)

lerp(color: Color, alpha: number): this
lerpColors(
color1: Color,
color2: Color,
alpha: number,
): this
lerpHSL(color: Color, alpha: number): this
multiply(color: Color): this
multiplyScalar(s: number): this
offsetHSL(
h: number,
s: number,
l: number,
): this
setColorName(style: string, colorSpace?: ColorSpace): Color

Sets this color from a color name. Faster than Color#setStyle | .setStyle() method if you don't need the other CSS-style formats.

setHex(hex: number, colorSpace?: ColorSpace): Color
setHSL(
h: number,
s: number,
l: number,
colorSpace?: ColorSpace,
): Color

Sets this color from HSL values. Based on MochiKit implementation by Bob Ippolito.

setRGB(
r: number,
g: number,
b: number,
colorSpace?: ColorSpace,
): Color

Sets this color from RGB values.

setScalar(scalar: number): Color
setStyle(style: string, colorSpace?: ColorSpace): Color

Sets this color from a CSS context style string.

sub(color: Color): this
toArray(array?: number[], offset?: number): number[]

Returns an array [red, green, blue], or copies red, green and blue into the provided array.

toArray(xyz: ArrayLike<number>, offset?: number): ArrayLike<number>

Copies red, green and blue into the provided array-like.

[Symbol.iterator](): Generator<number, void>

Static Properties

NAMES: Record<string, number>

List of X11 color names.