144 lines
6.7 KiB
Text
144 lines
6.7 KiB
Text
// Design tokens. Colours are set from Rust (theme_bridge.rs); everything else is fixed.
|
|
|
|
export struct TypeStyle {
|
|
size: length,
|
|
weight: int,
|
|
line-height: length,
|
|
}
|
|
|
|
export global Theme {
|
|
in-out property <bool> dark;
|
|
// Cookie and clover containers behind entry icons (a setting); off draws the plain icon.
|
|
in-out property <bool> icon-shapes: true;
|
|
|
|
// Material 3 colour roles (tonal spot scheme from the portal accent).
|
|
in-out property <color> primary;
|
|
in-out property <color> on-primary;
|
|
in-out property <color> primary-container;
|
|
in-out property <color> on-primary-container;
|
|
in-out property <color> inverse-primary;
|
|
in-out property <color> secondary;
|
|
in-out property <color> on-secondary;
|
|
in-out property <color> secondary-container;
|
|
in-out property <color> on-secondary-container;
|
|
in-out property <color> tertiary;
|
|
in-out property <color> on-tertiary;
|
|
in-out property <color> tertiary-container;
|
|
in-out property <color> on-tertiary-container;
|
|
in-out property <color> error;
|
|
in-out property <color> on-error;
|
|
in-out property <color> error-container;
|
|
in-out property <color> on-error-container;
|
|
in-out property <color> surface;
|
|
in-out property <color> surface-dim;
|
|
in-out property <color> surface-bright;
|
|
in-out property <color> surface-container-lowest;
|
|
in-out property <color> surface-container-low;
|
|
in-out property <color> surface-container;
|
|
in-out property <color> surface-container-high;
|
|
in-out property <color> surface-container-highest;
|
|
in-out property <color> on-surface;
|
|
in-out property <color> surface-variant;
|
|
in-out property <color> on-surface-variant;
|
|
in-out property <color> inverse-surface;
|
|
in-out property <color> inverse-on-surface;
|
|
in-out property <color> outline;
|
|
in-out property <color> outline-variant;
|
|
in-out property <color> shadow;
|
|
in-out property <color> scrim;
|
|
|
|
// Shape: corner radii. Concentric nesting: inner = outer - padding.
|
|
out property <length> corner-none: 0px;
|
|
out property <length> corner-xs: 4px;
|
|
out property <length> corner-sm: 8px;
|
|
out property <length> corner-md: 12px;
|
|
out property <length> corner-lg: 16px;
|
|
out property <length> corner-xl: 28px;
|
|
// Expressive surfaces: cards and panes, menus and their item pills.
|
|
out property <length> corner-card: 24px;
|
|
out property <length> corner-menu: 14px;
|
|
out property <length> corner-menu-item: 10px;
|
|
// Degrees a shaped container turns while it morphs to its active shape.
|
|
out property <float> shape-morph-turn: 20;
|
|
// Palette swatch in the settings, its ring when chosen.
|
|
out property <length> swatch: 36px;
|
|
out property <length> swatch-ring: 2px;
|
|
// Room round a shape's outline inside its path, as a share of its size.
|
|
out property <float> shape-margin: 0.1;
|
|
// Degrees a dialog's header shape turns through while the dialog opens.
|
|
out property <float> shape-enter-turn: -60;
|
|
// Wavy progress line: stroke, height of the wave above its centre, one wavelength.
|
|
out property <length> wave-stroke: 3px;
|
|
out property <length> wave-amplitude: 2px;
|
|
out property <length> wave-length: 20px;
|
|
// The player's wavy seek bar: stroke, wave height above its centre, one wavelength, and
|
|
// the handle at the playhead (a pill).
|
|
out property <length> seek-stroke: 4px;
|
|
out property <length> seek-amplitude: 3px;
|
|
out property <length> seek-wave-length: 32px;
|
|
out property <length> seek-handle-width: 4px;
|
|
out property <length> seek-handle-height: 20px;
|
|
// Fully rounded ends for a shape of the given height.
|
|
public pure function corner-full(height: length) -> length {
|
|
height / 2
|
|
}
|
|
|
|
// Spacing on a 4 px grid.
|
|
out property <length> space-1: 4px;
|
|
out property <length> space-2: 8px;
|
|
out property <length> space-3: 12px;
|
|
out property <length> space-4: 16px;
|
|
out property <length> space-6: 24px;
|
|
out property <length> space-8: 32px;
|
|
|
|
// Hairline borders.
|
|
out property <length> hairline: 1px;
|
|
// Pointer travel before a press on empty space becomes a selection box.
|
|
out property <length> drag-slop: 4px;
|
|
// The most a selection box scrolls its list per pointer move past an edge.
|
|
out property <length> band-scroll: 24px;
|
|
|
|
// Floating surfaces (menus, dialogs, toasts, tooltips): one soft shadow, mixed from
|
|
// `shadow`. Resting surfaces have none except the content card's faint lift.
|
|
// Values from the design references (Nacre): popups (menus, toasts, tooltips) lie close,
|
|
// dialogs higher; dark surfaces need a deeper shadow to read as lifted.
|
|
out property <length> float-shadow-blur: 10px;
|
|
out property <length> float-shadow-offset: 2px;
|
|
out property <float> float-shadow-opacity: root.dark ? 0.31 : 0.13;
|
|
out property <length> dialog-shadow-blur: 16px;
|
|
out property <length> dialog-shadow-offset: 4px;
|
|
out property <float> dialog-shadow-opacity: root.dark ? 0.35 : 0.16;
|
|
// The content card rests just above the window.
|
|
out property <length> card-shadow-blur: 6px;
|
|
out property <length> card-shadow-offset: 1px;
|
|
out property <float> card-shadow-opacity: root.dark ? 0.24 : 0.08;
|
|
// Dims the window behind a modal dialog, mixed from `scrim`.
|
|
out property <float> scrim-opacity: 0.32;
|
|
// Gap kept between a floating surface and the window edge.
|
|
out property <length> window-margin: 8px;
|
|
// Below this window height dialogs drop their cookie; below this width the toolbar
|
|
// drops its secondary buttons.
|
|
out property <length> dialog-cookie-min-height: 560px;
|
|
out property <length> toolbar-compact-width: 688px;
|
|
|
|
// Keyboard focus ring, drawn outside the control's shape.
|
|
out property <length> focus-ring-width: 2px;
|
|
out property <length> focus-ring-offset: 2px;
|
|
|
|
// Type: the system UI face plus the icon font; four sizes.
|
|
out property <string> icon-font: "Material Symbols Rounded";
|
|
out property <TypeStyle> title-large: { size: 22px, weight: 400, line-height: 28px };
|
|
out property <TypeStyle> title-medium: { size: 16px, weight: 500, line-height: 24px };
|
|
out property <TypeStyle> body-medium: { size: 14px, weight: 400, line-height: 20px };
|
|
out property <TypeStyle> body-small: { size: 12px, weight: 400, line-height: 16px };
|
|
out property <TypeStyle> label-large: { size: 14px, weight: 500, line-height: 20px };
|
|
out property <TypeStyle> label-medium: { size: 12px, weight: 500, line-height: 16px };
|
|
|
|
// State-layer opacities: tint = role.with-alpha(state-*).
|
|
out property <float> state-hover: 0.08;
|
|
out property <float> state-focus: 0.10;
|
|
out property <float> state-press: 0.10;
|
|
out property <float> state-drag: 0.16;
|
|
out property <float> disabled-content: 0.38;
|
|
out property <float> disabled-container: 0.12;
|
|
}
|