canvaskit-wasm 0.39
build 2026-04-29
TonalColorsInput
Input pair for CK.computeTonalColors — the helper that derives ambient and spot shadow colors from raw RGB values, applying Skia's perceptual scaling so soft shadows look natural across surface luminance.
const tones = CK.computeTonalColors({
ambient: CK.Color(0, 0, 0, 1), // pure black
spot: CK.Color(0, 0, 0, 1), // pure black
});
// tones is a TonalColorsOutput — two Color Float32Arrays adjusted by Skia.
canvas.drawShadow(path, zPlane, light, lightRadius, tones.ambient, tones.spot, flags);
Both fields accept any InputColor — a CK.Color(...)-style 4-float array, an Color4f, or a 32-bit color int.
Fields
| Field | Type | Notes |
|---|---|---|
ambient | InputColor | Author-chosen ambient shadow tint. |
spot | InputColor | Author-chosen spot shadow tint. |
See also
TonalColorsOutput— whatcomputeTonalColorsreturns.Canvas.drawShadow— consumer of the output.