ColourDataRawTransformer(uuid?: string, defaultValue?: TColorData)

Requires:
@ray-js/panel-sdk≥1.0.0

Description

Color light Raw-type DP protocol converter for bidirectional conversion between HSV values and the Raw DP hexadecimal protocol

Parameters

ParameterTypeRequiredDescription
uuidstringNoDP identifier, defaults to 'colour_data_raw'
NoDefault HSV value returned when parsing fails

Return Value

Type: ColourDataRawTransformer
ColourDataRawTransformer instance

Methods

MethodDescription
parserParse the Raw DP hexadecimal string into an HSV value object
formatterFormat the HSV value object into a Raw DP hexadecimal string

Examples

Example

import { ColourDataRawTransformer } from '@ray-js/panel-sdk';

const transformer = new ColourDataRawTransformer();
// Parse Raw DP string
const hsv = transformer.parser('00780a0a');
// => { hue: 120, saturation: 100, value: 100 }

// Format to Raw DP string
const dpStr = transformer.formatter({ hue: 120, saturation: 100, value: 100 });
// => '0078000a000a' (hue 4 digits + saturation/10 2 digits + value/10 2 digits)