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

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

Description

HS color setting protocol converter for bidirectional conversion between HS color values and the Zigbee DP protocol format

Parameters

ParameterTypeRequiredDescription
uuidstringNoDP identifier, defaults to 'hs_color_set'
NoDefault HS value, returned when parsing fails

Return Value

Type: HSColourSetTransformer
HSColourSetTransformer instance

Methods

MethodDescription
parserParse a DP hexadecimal string into an HS color value object
formatterFormat an HS color value object into a DP hexadecimal string

Examples

Example

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

const transformer = new HSColourTransformer();
// Parse a DP string into an HS object
const hs = transformer.parser('fefe');
// => { hue: 360, saturation: 1000 }

// Format an HS object into a DP string
const dpStr = transformer.formatter({ hue: 180, saturation: 500 });