canvaskit-wasm 0.39
build 2026-04-29
TonalColorsOutput
Result of CK.computeTonalColors. Two tonal-adjusted Color Float32Arrays ready to feed into Canvas.drawShadow.
const tones = CK.computeTonalColors({
ambient: CK.Color(0, 0, 0, 1),
spot: CK.Color(0, 0, 0, 1),
});
// tones.ambient and tones.spot are Float32Array (4-component RGBA in 0..1).
Skia adjusts the input colors so that — given the elevation (zPlane) and lightRadius you'll pass into drawShadow — the resulting soft-shadow falloff matches a perceptual model. Don't try to compute tonal colors by hand; the formula changes between Skia versions.
Fields
| Field | Type | Notes |
|---|---|---|
ambient | Color | Float32Array RGBA — pass to drawShadow as ambient color. |
spot | Color | Float32Array RGBA — pass to drawShadow as spot color. |
See also
TonalColorsInput— input shape.Canvas.drawShadow— final consumer.