Shader code
shaderGenerate GLSL, WGSL, HLSL, or MSL code to convert between color spaces, with ready entry functions for real GPU compilation—no hand-written color matrices.
Instructions
The conversion as shader source – GLSL (WebGL2; WebGL1 too unless the path reads a table), WGSL (WebGPU), HLSL (DirectX, Unity, Unreal) or MSL (Metal) – with an entry function <from>_<to> (hyphens stripped), e.g. vec3 rgb_oklch(vec3 c), plus every function on the path. Each language is differentially tested against the library and compiled on real GPUs: use it instead of writing color matrices. HLSL and MSL need the optional peer naga-wasm installed beside color-space.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | target space id, e.g. 'rgb', 'oklch', 'lab', 'slog3', 'rec709' (the 'spaces' tool lists all 221) | |
| from | Yes | source space id, e.g. 'rgb', 'oklch', 'lab', 'slog3', 'rec709' (the 'spaces' tool lists all 221) | |
| language | No | default glsl |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| entry | Yes | ||
| language | Yes |