|
1 | 1 | import { hexToRgba } from '@purestack/ts-css' |
2 | 2 | import { clamp } from '@purestack/ts-util' |
| 3 | +import type { SpotlightTokens } from '../../themePalette' |
3 | 4 | import type { ToneScale } from './shared' |
4 | 5 |
|
5 | 6 | export type ChromeState = 'rest' | 'hover' | 'active' | 'disabled' |
@@ -51,28 +52,26 @@ export type SpotlightColors = { |
51 | 52 | } |
52 | 53 |
|
53 | 54 | /** |
54 | | - * A deep field lit from one corner, for feature bands and showcase panels. |
| 55 | + * A deep field and a soft light, for feature bands and showcase panels. |
55 | 56 | * Unlike surfaces it has no gloss, hotspot, or edge shading, so large areas |
56 | | - * stay calm. The field runs from a lit edge down into the alternate surface. |
57 | | - * Light comes from the button color when it is brighter than the surface, so |
58 | | - * dark fields keep their hue, and from white on light fields. |
| 57 | + * stay calm. The field runs from a lit top edge down into the alternate |
| 58 | + * surface; tone-fill-spotlight places the light where the page asks. Light |
| 59 | + * comes from the button color when it is brighter than the surface, so dark |
| 60 | + * fields keep their hue, and from white on light fields. |
59 | 61 | */ |
60 | 62 | export function createSpotlight( |
61 | 63 | { surface, surfaceAlt, button }: SpotlightColors, |
62 | 64 | options: ChromeOptions = {}, |
63 | | -) { |
| 65 | +): SpotlightTokens { |
64 | 66 | const lighting = clamp(options.lighting ?? 0.72, 0, 1.5) |
65 | 67 | const light = luminance(button) > luminance(surface) ? button : '#ffffff' |
66 | | - return layered([ |
67 | | - radialAt('8% 0%', [ |
68 | | - [rgba(mix(light, '#ffffff', 0.4), 0.7 * lighting), '0%'], |
69 | | - ['transparent', '38%'], |
70 | | - ]), |
71 | | - linear('135deg', [ |
| 68 | + return { |
| 69 | + field: linear('165deg', [ |
72 | 70 | [mix(surface, light, 0.35), '0%'], |
73 | | - [mix(surface, surfaceAlt, 0.3), '75%'], |
| 71 | + [mix(surface, surfaceAlt, 0.15), '75%'], |
74 | 72 | ]), |
75 | | - ]) |
| 73 | + light: rgba(mix(light, '#ffffff', 0.4), 0.9 * lighting), |
| 74 | + } |
76 | 75 | } |
77 | 76 |
|
78 | 77 | export function createChrome( |
|
0 commit comments