Skip to main content

Class: HSV

Defined in: src/utils/ManimColor.ts:322

HSV color space, a ManimColor subclass.

It is constructed from [h,s,v] (or [h,s,v,a]) floats in 0.0..1.0 and keeps that representation internally, so operators and ManimColor.interpolate act in HSV space.

Extends​

Constructors​

Constructor​

new HSV(hsv, alpha): HSV

Defined in: src/utils/ManimColor.ts:325

Parameters​

hsv​

[number, number, number, number] | Hsv

alpha​

number = 1.0

Returns​

HSV

Overrides​

ManimColor.constructor

Properties​

value​

protected readonly value: Rgba

Defined in: src/utils/ManimColor.ts:104

Inherited from​

ManimColor.value

Accessors​

h​

Get Signature​

get h(): number

Defined in: src/utils/ManimColor.ts:354

Returns​

number


s​

Get Signature​

get s(): number

Defined in: src/utils/ManimColor.ts:358

Returns​

number


v​

Get Signature​

get v(): number

Defined in: src/utils/ManimColor.ts:362

Returns​

number

Methods​

constructFromSpace()​

protected constructFromSpace(space): ManimColor

Defined in: src/utils/ManimColor.ts:345

Build a color of this class from a space array. Overridden by subclasses.

Parameters​

space​

number[]

Returns​

ManimColor

Overrides​

ManimColor.constructFromSpace


darker()​

darker(blend): ManimColor

Defined in: src/utils/ManimColor.ts:237

Return a darker color: interpolated toward black. The opacity is unchanged.

Parameters​

blend​

number = 0.2

0.0 (unchanged) to 1.0 (pure black). Default 0.2.

Returns​

ManimColor

Inherited from​

ManimColor.darker


equals()​

equals(other): boolean

Defined in: src/utils/ManimColor.ts:257

Compare two colors with a numpy-style allclose tolerance.

Parameters​

other​

ManimColor

Returns​

boolean

Inherited from​

ManimColor.equals


fromInternal()​

protected fromInternal(rgba): ManimColor

Defined in: src/utils/ManimColor.ts:349

Build a color of this class from an [r,g,b,a] value (ManimCE _from_internal).

Parameters​

rgba​

Rgba

Returns​

ManimColor

Overrides​

ManimColor.fromInternal


getSpace()​

protected getSpace(): number[]

Defined in: src/utils/ManimColor.ts:341

The space used for operators and interpolation ([r,g,b,a] for the base).

Returns​

number[]

Overrides​

ManimColor.getSpace


internalRgba()​

protected internalRgba(): Rgba

Defined in: src/utils/ManimColor.ts:336

The [r,g,b,a] internal value. Overridden by subclasses.

Returns​

Rgba

Overrides​

ManimColor.internalRgba


interpolate()​

interpolate(other, alpha): ManimColor

Defined in: src/utils/ManimColor.ts:200

Interpolate toward other in this color's space.

alpha 0.0 returns a copy of this color, 1.0 returns other.

Parameters​

other​

ManimColor

alpha​

number

Returns​

ManimColor

Inherited from​

ManimColor.interpolate


invert()​

invert(withAlpha): ManimColor

Defined in: src/utils/ManimColor.ts:211

Return a linearly inverted color (1 - channel).

Parameters​

withAlpha​

boolean = false

If true, the alpha is inverted too. Default false.

Returns​

ManimColor

Inherited from​

ManimColor.invert


lighter()​

lighter(blend): ManimColor

Defined in: src/utils/ManimColor.ts:248

Return a lighter color: interpolated toward white. The opacity is unchanged.

Parameters​

blend​

number = 0.2

0.0 (unchanged) to 1.0 (pure white). Default 0.2.

Returns​

ManimColor

Inherited from​

ManimColor.lighter


opacity()​

opacity(opacity): ManimColor

Defined in: src/utils/ManimColor.ts:221

Return a new color with the given opacity and the same color values.

Parameters​

opacity​

number

Returns​

ManimColor

Inherited from​

ManimColor.opacity


toHex()​

toHex(withAlpha): string

Defined in: src/utils/ManimColor.ts:182

Convert to a #RRGGBB hex string, or #RRGGBBAA when withAlpha is true.

Parameters​

withAlpha​

boolean = false

Returns​

string

Inherited from​

ManimColor.toHex


toHsv()​

toHsv(): Hsv

Defined in: src/utils/ManimColor.ts:189

Convert to an [h,s,v] float array (0.0..1.0).

Returns​

Hsv

Inherited from​

ManimColor.toHsv


toIntRgb()​

toIntRgb(): Rgb

Defined in: src/utils/ManimColor.ts:168

Convert to an [r,g,b] integer array (0..255, truncated).

Returns​

Rgb

Inherited from​

ManimColor.toIntRgb


toIntRgba()​

toIntRgba(): Rgba

Defined in: src/utils/ManimColor.ts:174

Convert to an [r,g,b,a] integer array (0..255, truncated).

Returns​

Rgba

Inherited from​

ManimColor.toIntRgba


toRgb()​

toRgb(): Rgb

Defined in: src/utils/ManimColor.ts:156

Convert to an [r,g,b] float array (0.0..1.0).

Returns​

Rgb

Inherited from​

ManimColor.toRgb


toRgba()​

toRgba(): Rgba

Defined in: src/utils/ManimColor.ts:162

Convert to an [r,g,b,a] float array (0.0..1.0).

Returns​

Rgba

Inherited from​

ManimColor.toRgba


toString()​

toString(): string

Defined in: src/utils/ManimColor.ts:264

Return the #RRGGBB hex string, so a color interpolates into templates.

Returns​

string

Inherited from​

ManimColor.toString


withAlpha()​

withAlpha(alpha): ManimColor

Defined in: src/utils/ManimColor.ts:228

Alias of opacity.

Parameters​

alpha​

number

Returns​

ManimColor

Inherited from​

ManimColor.withAlpha


fromHex()​

static fromHex(hex, alpha): ManimColor

Defined in: src/utils/ManimColor.ts:281

Create a color from a hex string. Ports ManimColor.from_hex.

Parameters​

hex​

string

alpha​

number = 1.0

Returns​

ManimColor

Inherited from​

ManimColor.fromHex


fromHsv()​

static fromHsv(hsv, alpha): ManimColor

Defined in: src/utils/ManimColor.ts:286

Create a color from an [h,s,v] float array. Ports ManimColor.from_hsv.

Parameters​

hsv​

Hsv

alpha​

number = 1.0

Returns​

ManimColor

Inherited from​

ManimColor.fromHsv


fromRgb()​

static fromRgb(rgb, alpha): ManimColor

Defined in: src/utils/ManimColor.ts:271

Create a color from an RGB(A) float array. Ports ManimColor.from_rgb.

Parameters​

rgb​

Rgb | Rgba

alpha​

number = 1.0

Returns​

ManimColor

Inherited from​

ManimColor.fromRgb


fromRgba()​

static fromRgba(rgba): ManimColor

Defined in: src/utils/ManimColor.ts:276

Create a color from an RGBA float array. Ports ManimColor.from_rgba.

Parameters​

rgba​

Rgba

Returns​

ManimColor

Inherited from​

ManimColor.fromRgba


parse()​

static parse(color, alpha): ManimColor | ManimColor[]

Defined in: src/utils/ManimColor.ts:299

Parse one color, or a list of colors.

A numeric array (length 3 or 4) is read as a single RGB(A) color. An array whose elements are themselves colors (strings, numbers-as-ints via nested arrays, or ManimColors) is read as a list. This resolves ManimCE's documented "array of numbers becomes a list of colors" footgun in favor of the single-color reading.

Parameters​

color​

ParsableManimColor | ParsableManimColor[]

alpha​

number = 1.0

Returns​

ManimColor | ManimColor[]

Inherited from​

ManimColor.parse