palette-shader 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -182,6 +182,33 @@ Returns the current shader result at normalized UV coordinates (`0–1` on both
182
182
  const color = viz.getColorAtUV(0.5, 0.5); // center
183
183
  ```
184
184
 
185
+ ### `getColorAtUV_float(x, y)`
186
+
187
+ Returns the color at normalized UV coordinates as `[r, g, b]` in **unclamped linear RGB** with full float precision. Unlike `getColorAtUV`, values are not quantized to 8-bit and are not clamped to `[0, 1]` — out-of-gamut colors preserve their original value. The sRGB transfer function is bypassed so the consumer receives linear-light values suitable for further color-space conversions without double-gamma.
188
+
189
+ Renders a single pixel on demand into a 1×1 `RGBA16F` framebuffer — zero per-frame cost.
190
+
191
+ ```js
192
+ const [r, g, b] = viz.getColorAtUV_float(0.5, 0.5);
193
+ // r, g, b are linear RGB — may be < 0 or > 1 for out-of-gamut colors
194
+ ```
195
+
196
+ Converting to OKLab (or any other color space) with [culori](https://culorijs.org/):
197
+
198
+ ```js
199
+ import { converter, formatCss } from 'culori';
200
+
201
+ const toOklab = converter('oklab');
202
+ const [r, g, b] = viz.getColorAtUV_float(0.5, 0.5);
203
+
204
+ // Feed linear RGB directly into culori's linear-sRGB mode
205
+ const oklab = toOklab({ mode: 'lrgb', r, g, b });
206
+ // → { mode: 'oklab', l: 0.72, a: 0.08, b: 0.12 }
207
+
208
+ formatCss(oklab);
209
+ // → 'oklab(0.72 0.08 0.12)'
210
+ ```
211
+
185
212
  ---
186
213
 
187
214
  ## Color models
@@ -90,6 +90,7 @@ export declare class PaletteViz extends BasePaletteRenderer {
90
90
  removeColor(index: number): void;
91
91
  removeColor(color: ColorRGB): void;
92
92
  getColorAtUV(x: number, y: number): ColorRGB;
93
+ getColorAtUV_float(x: number, y: number): ColorRGB;
93
94
  set position(value: number);
94
95
  get position(): number;
95
96
  set axis(axis: Axis);