Skip to content

openrv-web / ColorAPI

Class: ColorAPI ​

Defined in: api/ColorAPI.ts:89

Extends ​

  • DisposableAPI

Constructors ​

Constructor ​

new ColorAPI(colorControls, cdlControl, curvesControl, lutProvider?, toneMappingProvider?, displayProvider?, displayCapabilitiesProvider?, ocioProvider?, lutPipelineProvider?): ColorAPI

Defined in: api/ColorAPI.ts:113

Parameters ​

colorControls ​

ColorAdjustmentProvider

cdlControl ​

CDLProvider

curvesControl ​

CurvesProvider

lutProvider? ​

LUTProvider

toneMappingProvider? ​

ToneMappingProvider

displayProvider? ​

DisplayProvider

displayCapabilitiesProvider? ​

DisplayCapabilitiesProvider

ocioProvider? ​

OCIOProvider

lutPipelineProvider? ​

LUTPipelineProvider

Returns ​

ColorAPI

Overrides ​

DisposableAPI.constructor

Methods ​

applyLUTPreset() ​

applyLUTPreset(name): void

Defined in: api/ColorAPI.ts:527

Apply a built-in LUT preset by name.

Parameters ​

name ​

string

Preset identifier (e.g. 'warm-film', 'bleach-bypass', 'identity').

Returns ​

void

Throws ​

If the preset name is not recognized.

Example ​

ts
openrv.color.applyLUTPreset('warm-film');

clearLUT() ​

clearLUT(): void

Defined in: api/ColorAPI.ts:510

Clear the currently active LUT.

Returns ​

void

Example ​

ts
openrv.color.clearLUT();

dispose() ​

dispose(): void

Defined in: api/Disposable.ts:19

Mark this sub-API as disposed. After this call, assertNotDisposed() will throw on every subsequent invocation.

Returns ​

void

Inherited from ​

DisposableAPI.dispose


exportCurvesJSON() ​

exportCurvesJSON(): string

Defined in: api/ColorAPI.ts:420

Export current curves as a JSON string.

Returns ​

string

A JSON string representation of the current curves data.

Example ​

ts
const json = openrv.color.exportCurvesJSON();
localStorage.setItem('myCurves', json);

getAdjustments() ​

getAdjustments(): PublicColorAdjustments

Defined in: api/ColorAPI.ts:201

Get current color adjustments.

Returns ​

PublicColorAdjustments

A snapshot of all current color adjustment values.

Example ​

ts
const adj = openrv.color.getAdjustments();
console.log(adj.exposure, adj.gamma);

getAvailableConfigs() ​

getAvailableConfigs(): object[]

Defined in: api/ColorAPI.ts:931

Get the list of available OCIO configurations (both built-in and custom).

This is a static query that does not require an OCIO provider.

Returns ​

object[]

An array of configuration descriptors with name and description.

Example ​

ts
const configs = openrv.color.getAvailableConfigs();
configs.forEach(c => console.log(c.name, c.description));

getCDL() ​

getCDL(): CDLValues

Defined in: api/ColorAPI.ts:310

Get current CDL values (returns a defensive copy).

Returns ​

CDLValues

A deep copy of the current CDL slope, offset, power, and saturation values.

Example ​

ts
const cdl = openrv.color.getCDL();
console.log(cdl.slope.r, cdl.offset.g, cdl.saturation);

getCurves() ​

getCurves(): PublicColorCurvesData

Defined in: api/ColorAPI.ts:364

Get current curves.

Returns a defensive deep copy of master/red/green/blue channels.

Returns ​

PublicColorCurvesData


getDisplayCapabilities() ​

getDisplayCapabilities(): DisplayCapabilities

Defined in: api/ColorAPI.ts:855

Get the probed display capabilities.

Returns ​

DisplayCapabilities

A snapshot of the display capability detection results.

Example ​

ts
const caps = openrv.color.getDisplayCapabilities();
console.log(caps.displayGamut, caps.displayHDR);

getDisplayProfile() ​

getDisplayProfile(): DisplayColorState

Defined in: api/ColorAPI.ts:834

Get the current display color profile.

Returns ​

DisplayColorState

A snapshot of the current display color state.


getLUTStageColorPrimaries() ​

getLUTStageColorPrimaries(stage): ColorPrimaries | null

Defined in: api/ColorAPI.ts:633

Read the declared output color primaries for a LUT pipeline stage.

Parameters ​

stage ​

LUTPipelineStage

One of 'precache', 'file', 'look', 'display'.

Returns ​

ColorPrimaries | null

null if the stage is color-space-preserving, otherwise the declared value.

Throws ​

If no LUT pipeline provider is configured.

Throws ​

On invalid stage.

Example ​

ts
const primaries = openrv.color.getLUTStageColorPrimaries('file');

getLUTStageTransferFunction() ​

getLUTStageTransferFunction(stage): TransferFunction | null

Defined in: api/ColorAPI.ts:690

Read the declared output transfer function for a LUT pipeline stage.

Parameters ​

stage ​

LUTPipelineStage

One of 'precache', 'file', 'look', 'display'.

Returns ​

TransferFunction | null

null if the stage is transfer-preserving, otherwise the declared value.

Throws ​

If no LUT pipeline provider is configured.

Throws ​

On invalid stage.


getOCIOState() ​

getOCIOState(): OCIOState

Defined in: api/ColorAPI.ts:912

Get current OCIO pipeline state.

Returns ​

OCIOState

A snapshot of the current OCIO configuration.

Example ​

ts
const state = openrv.color.getOCIOState();
console.log(state.configName, state.inputColorSpace);

getToneMapping() ​

getToneMapping(): ToneMappingState

Defined in: api/ColorAPI.ts:782

Get the current tone mapping state.

Returns ​

ToneMappingState

A snapshot of the current tone mapping configuration.

Example ​

ts
const tm = openrv.color.getToneMapping();
console.log(tm.operator, tm.enabled);

importCurvesJSON() ​

importCurvesJSON(json): void

Defined in: api/ColorAPI.ts:440

Import curves from a JSON string.

The JSON must contain valid master, red, green, and blue channel data.

Parameters ​

json ​

string

A JSON string previously obtained from exportCurvesJSON().

Returns ​

void

Throws ​

If the JSON string is not valid or does not contain valid curves data.

Example ​

ts
const json = localStorage.getItem('myCurves');
if (json) openrv.color.importCurvesJSON(json);

loadLUT() ​

loadLUT(lut): void

Defined in: api/ColorAPI.ts:476

Load a LUT (Look-Up Table) directly from a parsed LUT object.

Parameters ​

lut ​

A parsed LUT object (1D or 3D). Pass null to clear.

LUT | null

Returns ​

void

Example ​

ts
openrv.color.loadLUT(parsedLut);

reset() ​

reset(): void

Defined in: api/ColorAPI.ts:228

Reset all color adjustments to their default values.

Returns ​

void

Example ​

ts
openrv.color.reset();

resetCDL() ​

resetCDL(): void

Defined in: api/ColorAPI.ts:395

Reset CDL values to their defaults (slope 1.0, offset 0.0, power 1.0, saturation 1.0).

Returns ​

void

Example ​

ts
openrv.color.resetCDL();

resetCurves() ​

resetCurves(): void

Defined in: api/ColorAPI.ts:378

Reset all curves to the default identity state.

Returns ​

void


setAdjustments() ​

setAdjustments(adjustments): void

Defined in: api/ColorAPI.ts:152

Set color adjustments (partial update - merges with current values).

Only the provided keys are updated; the rest retain their current values.

Parameters ​

adjustments ​

Partial<PublicColorAdjustments>

An object with one or more color adjustment fields to update. Valid keys: exposure, gamma, saturation, contrast, hueRotation, temperature, tint, brightness, highlights, shadows, whites, blacks.

Returns ​

void

Throws ​

If adjustments is not a plain object, or if any provided numeric field is not a finite number.

Example ​

ts
openrv.color.setAdjustments({ exposure: 1.5, saturation: 0.8 });

setCDL() ​

setCDL(cdl): void

Defined in: api/ColorAPI.ts:268

Set CDL (Color Decision List) values (partial update - merges with current values).

Each of slope, offset, and power must be an object with numeric r, g, b fields. saturation must be a number. Only provided keys are updated.

Parameters ​

cdl ​

Partial<CDLValues>

An object with one or more CDL fields: slope, offset, power, saturation.

Returns ​

void

Throws ​

If cdl is not a plain object, or if slope/offset/power do not have numeric r, g, b fields, or if saturation is not a number.

Example ​

ts
openrv.color.setCDL({ slope: { r: 1.1, g: 1.0, b: 0.9 }, saturation: 1.2 });

setCurves() ​

setCurves(curves): void

Defined in: api/ColorAPI.ts:335

Set color curves with support for per-channel partial updates.

Any subset of channels can be provided. Within each channel update, enabled and/or points may be provided.

Parameters ​

curves ​

PublicColorCurvesUpdate

Returns ​

void

Example ​

ts
openrv.color.setCurves({
  red: { points: [{ x: 0, y: 0.05 }, { x: 1, y: 0.95 }] },
  blue: { enabled: false }
});

setDisplayProfile() ​

setDisplayProfile(profile): void

Defined in: api/ColorAPI.ts:818

Set the display color profile.

Parameters ​

profile ​

Partial<DisplayColorState>

Display color state including transfer function, gamma, brightness.

Returns ​

void

Throws ​

If profile is not a plain object.

Example ​

ts
openrv.color.setDisplayProfile({
  transferFunction: 'rec709',
  displayGamma: 1.0,
  displayBrightness: 1.0,
  customGamma: 2.2,
});

setLUTIntensity() ​

setLUTIntensity(value): void

Defined in: api/ColorAPI.ts:493

Set the LUT blending intensity (0 = bypass, 1 = full effect).

Parameters ​

value ​

number

Intensity in [0, 1].

Returns ​

void

Throws ​

If value is not a finite number.

Example ​

ts
openrv.color.setLUTIntensity(0.75);

setLUTStageColorPrimaries() ​

setLUTStageColorPrimaries(stage, primaries): void

Defined in: api/ColorAPI.ts:601

Declare the output color primaries for a LUT pipeline stage.

Pass null to mark the stage as color-space-preserving (the default). Pass a concrete value ('bt709', 'bt2020', 'p3') when the LUT is known to convert into that primary set; the per-stage cascade in Viewer.applyLUTMetadataCascade layers this on top of the input image metadata so downstream stages and the renderer interpret pixels correctly.

The string 'auto' is not accepted — pass null instead. This matches the underlying pipeline's null-sentinel contract.

Parameters ​

stage ​

LUTPipelineStage

One of 'precache', 'file', 'look', 'display'.

primaries ​

null (color-space-preserving) or a concrete primaries value.

ColorPrimaries | null

Returns ​

void

Throws ​

If no LUT pipeline provider is configured.

Throws ​

On invalid stage / primaries values.

Example ​

ts
openrv.color.setLUTStageColorPrimaries('file', 'bt709');
openrv.color.setLUTStageColorPrimaries('file', null); // clear

setLUTStageTransferFunction() ​

setLUTStageTransferFunction(stage, transfer): void

Defined in: api/ColorAPI.ts:661

Declare the output transfer function for a LUT pipeline stage.

Pass null to mark the stage as transfer-preserving (the default). Pass a concrete value ('srgb', 'hlg', 'pq', 'smpte240m', 'linear') when the LUT bakes in an EOTF/OETF transformation so the downstream renderer can pick the correct shader path.

The string 'auto' is not accepted — pass null instead.

Parameters ​

stage ​

LUTPipelineStage

One of 'precache', 'file', 'look', 'display'.

transfer ​

null (transfer-preserving) or a concrete transfer value.

TransferFunction | null

Returns ​

void

Throws ​

If no LUT pipeline provider is configured.

Throws ​

On invalid stage / transfer values.

Example ​

ts
openrv.color.setLUTStageTransferFunction('look', 'linear');
openrv.color.setLUTStageTransferFunction('look', null); // clear

setOCIOState() ​

setOCIOState(state): void

Defined in: api/ColorAPI.ts:892

Set OCIO pipeline state (partial update - merges with current values).

Parameters ​

state ​

Partial<OCIOState>

Partial OCIO state to merge.

Returns ​

void

Throws ​

If state is not a plain object.

Example ​

ts
openrv.color.setOCIOState({
  enabled: true,
  configName: 'aces_1.2',
  inputColorSpace: 'ARRI LogC3 (EI 800)',
});

setToneMapping() ​

setToneMapping(options): void

Defined in: api/ColorAPI.ts:723

Set tone mapping options.

Parameters ​

options ​

Partial<ToneMappingState>

Partial tone mapping state. At minimum, provide enabled and/or operator.

Returns ​

void

Throws ​

If options is not a plain object or contains invalid values.

Example ​

ts
openrv.color.setToneMapping({ operator: 'aces', enabled: true });
openrv.color.setToneMapping({ enabled: false });

Released under the MIT License.