---
name: "DreamlightSceneModeTransformer"
mode: "api"
versionRequirements:
  - { name: "@ray-js/panel-sdk", version: "1.0.0" }
title: "DreamlightSceneModeTransformer"
summary: "DreamlightSceneModeTransformer is used to parse the lighting `dreamlight_scene_mode` DP and provides parsing and formatting for the dreamlight scene mode."
questions:
  - "What is DreamlightSceneModeTransformer used for?"
  - "How does DreamlightSceneModeTransformer parse the dreamlight scene mode data?"
  - "What are the input and output of DreamlightSceneModeTransformer?"
  - "What are the transformation rules of DreamlightSceneModeTransformer?"
---

## DreamlightSceneModeTransformer

> [VERSION] @ray-js/panel-sdk >= 1.0.0

> 💡 Scene mode DP for addressable light strip products (e.g., dreamlight_scene_mode), supporting standard scene modes and mixed scene modes.
> The protocol includes parameters such as version, scene ID, transition type, speed, direction control, color list, etc.
> Each color unit is 3 bytes (hue 2 bytes + saturation 1 byte), and brightness is shared across all colors.

### Description

Addressable light strip scene-mode protocol converter for bidirectional conversion between dynamic scene configuration data and the DP hexadecimal protocol

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `uuid` | `string` | No | DP identifier, defaults to 'dreamlight_scene_mode' |
| `defaultValue` | `{ version: number, id: number, mode: number, speed: number, segmented: number, loop: number, excessive: number, direction: number, expand: number, reserved1: number, reserved2: number, brightness: number, colors: SceneColorType[] }` | No | Default scene data to return when parsing fails |

### Return Value

Type: `DreamlightSceneModeTransformer`

DreamlightSceneModeTransformer instance

#### Methods

| Method | Description |
| --- | --- |
| `parser` | Parse the DP hexadecimal string into a dreamlight scene-mode data object |
| `formatter` | Format a dreamlight scene-mode data object into a DP hexadecimal string |

### Referenced Types

##### `interface` SceneColorType

| Property | Type | Description |
| --- | --- | --- |
| `hue` | `number` | Hue |
| `saturation` | `number` | Saturation |


### Examples

#### Example

```ts
import { DreamlightSceneModeTransformer } from '@ray-js/panel-sdk';

const transformer = new DreamlightSceneModeTransformer();
// Parse scene DP string
const scene = transformer.parser('01c8010d0d00000064007003e8');

// Format to DP string
const dpStr = transformer.formatter({
  id: 200, mode: 1, speed: 13,
  brightness: 1000,
  colors: [{ hue: 0, saturation: 1000 }, { hue: 120, saturation: 800 }],
});
```
