API reference

aster_blueprint::design

Pre-1.0: signatures are not frozen. Generated from rustdoc JSON of the compiled crate; rustdoc JSON format version 60. Only public items are listed.

Design tokens and built-in themes: "polished" as the default.

A [Theme] is one small, typed bag of design tokens:

  • color roles ([Role]): background, surface, surface-raised, border, text, text-muted, accent, success, warning, danger, info and an on_* content color for each fill that carries text;
  • a type scale ([Type] -> [TypeStyle]: size, weight, line height);
  • a spacing scale (theme.space(n)), a radii scale ([Radius]);
  • elevation presets 0..=4 ([Elevation]) that map onto the real [DropShadow] / [Glow] kernel parameters plus an optional stroke edge, and ready-made material [LayerSpec]s;
  • state layers ([State], [StateLayers]) and a focus ring ([FocusRing], stroke plus glow).

Six built-ins ship ([Theme::mission_dark], [Theme::mission_light], [Theme::paper_light], [Theme::paper_dark], [Theme::high_contrast_dark], [Theme::high_contrast_light]) and [Theme::from_accent] derives a full, contrast-audited theme from a single accent color.

[Theme::resource_theme] exports every token as a named, typed literal resource of the existing [crate::theme::Theme] dictionary (theme.color.accent is Srgb8, theme.radius.md is LogicalLength, ...). Every design theme exports exactly the same names and types, so a compiled plan that binds Binding::Resource("theme.color.accent") stays valid when the theme changes: [Theme::rebase_instance] swaps the base of a ThemeInstance and the next evaluate yields the new colors. No graph rebuild, no recompile, no retarget.

Structs

structaster_blueprint::design::ContrastIssue

pub struct ContrastIssue { /* see fields */ }

One failed contrast pair reported by [Theme::audit].

Public fields

fieldtype
pair&'static str
ratiof64
requiredf64

Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::design::Edge

pub struct Edge { /* see fields */ }

A stroked edge of an elevation or surface.

Public fields

fieldtype
widthf64
coloraster_ui::Srgb8
alignmentaster_ui::VectorStrokeAlignment

Trait implementations: Clone, Copy, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::design::Elevation

pub struct Elevation { /* see fields */ }

One elevation preset. offset, sigma, spread and shadow are exactly the [DropShadow] kernel parameters.

Public fields

fieldtype
levelu8
offset[f64; 2]
sigmaf64
spreadf64
shadowaster_ui::Srgb8
edgeOption<Edge>
glowOption<GlowSpec>

Methods

  • fn drop_shadow(&self, w: f64, h: f64, radius: f64, scale: f64) -> Option<DropShadow> — The kernel parameters for a w x h shape, or None for a flat level.
  • fn layers(&self, key: &str, bounds: LogicalRect, radius: f64, scale: f64) -> Result<Vec<LayerSpec>, Error> — Material layers for a shape of bounds with corner radius: {key}.shadow and {key}.glow (both Outside, so the part root must not clip) and {key}.edge (Outline). Flat levels give an empty list.

Trait implementations: Clone, Copy, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::design::FocusRing

pub struct FocusRing { /* see fields */ }

Focus ring: an outer stroke separated from the control by offset, plus an optional glow (intensity == 0 disables it).

Public fields

fieldtype
coloraster_ui::Srgb8
widthf64
offsetf64
glow_sigmaf64
glow_intensityf64

Methods

  • fn layers(&self, key: &str, bounds: LogicalRect, radius: f64, scale: f64) -> Result<Vec<LayerSpec>, Error> — {key}.ring (and {key}.halo when glowing) layers for a control of bounds with corner radius. Both are Outside/Outline layers placed outside bounds, so the part root must not clip.

Trait implementations: Clone, Copy, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::design::GlowSpec

pub struct GlowSpec { /* see fields */ }

An accent halo of an elevation.

Public fields

fieldtype
coloraster_ui::Srgb8
sigmaf64
spreadf64
intensityf64

Trait implementations: Clone, Copy, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::design::MotionToken

pub struct MotionToken { /* see fields */ }

A named duration + easing pairing.

Public fields

fieldtype
durationMotionDuration
easeEase

Methods

  • const fn new(duration: MotionDuration, ease: Ease) -> Self
  • const FAST: Self — fast + standard: hover/press/focus fades, knobs.
  • const NORMAL: Self — normal + standard: meters, tab indicator.
  • const SLOW: Self — slow + standard: number tweens.
  • const EMPHASIZED: Self — normal + emphasized: hero entrances.
  • const ENTER: Self — normal + decelerate: something arriving.
  • const EXIT: Self — fast + accelerate: something leaving.
  • const SPRING: Self — fast + spring: a toggle that snaps into place (a switch, a checkbox).

Trait implementations: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

structaster_blueprint::design::MotionTokens

pub struct MotionTokens { /* see fields */ }

The motion scale of a theme.

Public fields

fieldtype
fast_msu32
normal_msu32
slow_msu32
standard[f64; 4]Cubic-bezier controls [x1, y1, x2, y2].
emphasized[f64; 4]
decelerate[f64; 4]
accelerate[f64; 4]
spring[f64; 4]The overshoot curve of a control that snaps into place.
reducedboolReduced motion: every duration is 0, every transition is instant.

Methods

  • fn ms(&self, d: MotionDuration) -> u32 — Milliseconds of a duration token (0 when reduced).
  • fn curve(&self, e: Ease) -> Curve — The curve of an easing token.
  • fn ease(&self, e: Ease, t: f64) -> f64 — Eased progress for t in 0..=1 (clamped).

Trait implementations: Clone, Copy, Debug, Default, PartialEq, StructuralPartialEq

structaster_blueprint::design::Skin

pub struct Skin { /* see fields */ }

The skin: the depth, light and gradient tokens the default controls wear.

Every number here is a magnitude, not a colour: the skin is resolved against the theme's palette at render time (see ui::skin), so one skin dresses a light theme and a dark one. A high-contrast theme keeps the rhythm (spacing, radii, row heights) and drops the soft effects (soft is false): the outlines carry the structure instead.

Public fields

fieldtype
liftf64Px a control rises at full hover (0 = it does not move).
sinkf64Px a control sinks at full press.
hover_elevu8Elevation steps a control gains at full hover (0 = none).
button_gradientf64How much the top of a filled button is lightened (0..1).
button_shadow_facef64How much the bottom of a filled button is darkened (0..1).
button_highlightf64Alpha of the 1 px inner top highlight of a filled button (0..1).
button_glowf64Intensity of the coloured halo under a filled button (0..1).
focus_glowf64Sigma of the focus halo (px); 0 = a hard ring only.
focus_glow_intensityf64Intensity of the focus halo (0..1).
input_insetf64How dark an input surface sits below its page (0..1).
input_glowf64Intensity of the glow an input shows while it has the focus (0..1).
surface_highlightf64Alpha of the hairline top highlight of a raised surface (0..1).
surface_ambientf64Intensity of the wide ambient halo of a raised surface (0..1).
surface_elevu8Elevation level of a raised surface.
row_heightf64Row height of a table row (px).
header_heightf64Header height of a table header (px).
glass_alphaf64Fill alpha of a glass surface over a rich background (0..1).
glass_blurf64Blur sigma of a glass surface (px).
softboolFalse in a high-contrast theme: no soft effects, no transparency.
materialMaterialThe material the controls wear (flat, neu or glass).
neu_lightf64Alpha of the light shadow a raised surface throws up-left (0..1).
neu_darkf64Alpha of the dark shadow a raised surface throws down-right (0..1).
neu_blurf64Sigma of the two shadows of a raised surface (px).
neu_offsetf64How far the two shadows of a raised surface are offset (px).
neu_insetf64Strength of the debossed inner shadow of a well (0..1).
neu_inset_blurf64Sigma of the debossed inner shadow of a well (px).
glass_rimf64Alpha of the 1 px lit rim of a glass face (0..1).
glass_saturationf64Saturation of the frosted backdrop of a glass face (1 = unchanged).
glass_grainf64Film grain over a glass face (0..1).
backdropf64Strength of the page backdrop behind the app (0 = none).
backdrop_grainf64Film grain over the page backdrop (0..1).
touchf64The smallest height an interactive control may take (px); 0 = what the builder asks for (the default: a touch shell sets it, the sizes of the standard controls are pinned by tests).

Trait implementations: Clone, Copy, Debug, Default, PartialEq, StructuralPartialEq

structaster_blueprint::design::StateLayers

pub struct StateLayers { /* see fields */ }

Strength of each state layer (0..=1, how far the fill moves toward its content color; disabled instead fades toward the background).

Public fields

fieldtype
hoverf64
pressf64
focusf64
disabledf64Remaining opacity of a disabled fill or text (0.38 is typical).

Trait implementations: Clone, Copy, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::design::SystemPrefs

pub struct SystemPrefs { /* see fields */ }

The accessibility and appearance settings of the operating system.

Public fields

fieldtype
darkboolThe system is in dark mode (prefers-color-scheme: dark).
high_contrastboolIncreased contrast (prefers-contrast: more).
reduced_motionboolReduced motion (prefers-reduced-motion: reduce).
reduced_transparencyboolReduced transparency (prefers-reduced-transparency: reduce): frosted glass is drawn as a solid surface.
text_scalef64The user's text size (Dynamic Type, Android font scale): every type step is multiplied by it. 1. is the theme's own; kept within 0.5..=3..

Methods

  • fn new() -> Self — Light mode, nothing reduced, the theme's own text size.
  • fn text_scale(self, k: f64) -> Self
  • fn from_env() -> Self — The settings an environment names: ASTER_DARK, ASTER_CONTRAST (or ASTER_HIGH_CONTRAST), ASTER_REDUCE_MOTION, ASTER_REDUCE_TRANSPARENCY (1, true, yes, on are on; anything else or nothing is off) and ASTER_TEXT_SCALE (a number). A host with no OS to ask (a kiosk, a test run, a CI screenshot) calls this once at start; it reads the process environment only when called.
  • fn from_lookup(get: impl Fn(&str) -> Option<String>) -> Self — [SystemPrefs::from_env] over any lookup (a map in a test, a config file).
  • fn dark(self, on: bool) -> Self
  • fn high_contrast(self, on: bool) -> Self
  • fn reduced_motion(self, on: bool) -> Self
  • fn reduced_transparency(self, on: bool) -> Self

Trait implementations: Clone, Copy, Debug, Default, PartialEq, StructuralPartialEq

structaster_blueprint::design::SystemThemes

pub struct SystemThemes { /* see fields */ }

The theme each system setting selects. The default is mission light / dark and the two high-contrast built-ins.

Public fields

fieldtype
lightsuper::Theme
darksuper::Theme
high_contrast_lightsuper::Theme
high_contrast_darksuper::Theme

Methods

  • fn new(light: &Theme, dark: &Theme) -> Self — A light and a dark theme; increased contrast uses the high-contrast built-ins.
  • fn high_contrast(self, light: &Theme, dark: &Theme) -> Self — Your own increased-contrast pair.
  • fn brand_high_contrast(self) -> Self — Increased contrast keeps your brand: the pair is derived from the accents of light and dark ([Theme::increased_contrast]) instead of the built-in high-contrast themes.
  • fn resolve(&self, prefs: SystemPrefs) -> Theme — The theme prefs selects, with its reduced-motion and reduced-transparency flags set.

Trait implementations: Clone, Debug, Default, PartialEq, StructuralPartialEq

structaster_blueprint::design::Theme

pub struct Theme { /* see fields */ }

A complete set of design tokens.

Methods

  • fn motion(&self) -> MotionTokens — The theme's motion tokens.
  • fn with_motion(self, m: MotionTokens) -> Self — Replace the motion tokens (custom durations or curves).
  • fn with_reduced_motion(self, reduced: bool) -> Self — Reduced motion: all transitions become instant.
  • fn increased_contrast(&self) -> Theme — This theme's increased-contrast sibling: the same accent and mode in Style::Contrast (square corners, 2 px strokes, text pairs at 7:1), named <name>-contrast. Reduced motion and transparency carry over.
  • fn reduced_transparency(&self) -> bool — Whether frosted glass is drawn as a solid surface (see [SystemPrefs::reduced_transparency]).
  • fn text_scale(&self) -> f64 — The user's text size multiplier (see [SystemPrefs::text_scale]).
  • fn with_text_scale(self, k: f64) -> Self — The type steps at k times the theme's own size (absolute: with_text_scale(1.) undoes with_text_scale(1.5); non-finite values are ignored, others kept within 0.5..=3.). It composes with the density's scale ([Theme::with_type_scale]).
  • fn with_reduced_transparency(self, on: bool) -> Self — Reduced transparency: .glass(..) panels become the opaque surface colour, with no backdrop blur.
  • fn name(&self) -> &str
  • fn mode(&self) -> Mode
  • fn style(&self) -> Style
  • fn color(&self, role: Role) -> Srgb8 — Color of a role.
  • fn tint(&self, role: Role, alpha: f64) -> Srgb8 — A role at alpha (0..=1), for tints, scrims and soft chips.
  • fn text(&self, t: Type) -> TypeStyle — Type scale step.
  • fn tokens(&self, t: Type) -> TypeTokens — The tokens of a type scale step: the size, the weight, the line height, the letter spacing (in em) and the face the step draws with.
  • fn with_tracking(self, t: Type, tracking: f64) -> Self — The letter spacing of a type step, in em (negative is tighter, positive is wider). A non-finite value is ignored.
  • fn with_type_face(self, t: Type, face: &'static str) -> Self — The face of a type step (the name of a registered face: "ui", "bold", "mono", "display", ...).
  • fn space(&self, step: usize) -> f64 — Spacing step 0..=11 (0, 2, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64 at density 1); larger indices clamp to the last step.
  • fn radius(&self, r: Radius) -> f64 — Radius token. [Radius::Full] is [FULL_RADIUS]; use [Theme::radius_for].
  • fn radius_for(&self, r: Radius, w: f64, h: f64) -> f64 — Radius token clamped to half the shorter side of a w x h shape.
  • fn elevation(&self, level: u8) -> &Elevation — Elevation preset; levels above [MAX_ELEVATION] clamp.
  • fn states(&self) -> StateLayers
  • fn focus_ring(&self) -> FocusRing
  • fn skin(&self) -> &Skin — The skin tokens: the depth, light and gradient of the default controls.
  • fn with_skin(self, skin: Skin) -> Self — The skin tokens, replaced (the whole set).
  • fn material(&self) -> Material — The material the controls wear (flat, neu or glass).
  • fn with_material(self, m: Material) -> Self — Wear another material (the one call that overrides a theme's default: Theme::paper_light().with_material(Material::Glass)).
  • fn focus_edge(&self) -> Srgb8 — The border an input shows while it has the focus: the accent, moved until it holds 3:1 against the background and every surface (the plain border when the accent cannot get there).
  • fn raise(&self, role: Role, t: f64) -> Srgb8 — A role lightened toward white by t (the lit top of a gradient).
  • fn lower(&self, role: Role, t: f64) -> Srgb8 — A role darkened toward black by t (the shaded bottom of a gradient).
  • fn border_width(&self) -> f64 — Stroke width of a plain Border outline (1, or 2 for high contrast).
  • fn state_color(&self, base: Srgb8, state: State) -> Srgb8 — A fill color in an interaction state. Hover/press/focus move the fill toward its readable content color; disabled fades it into the background.
  • fn select_color(&self, base: Srgb8) -> Srgb8 — The selected look of a fill: base moved toward the accent by 14 %, stopping where content that is readable on base would stop being.
  • fn fit_mix(&self, a: Srgb8, b: Srgb8, t: f64) -> Srgb8 — mix(a, b, t) with t reduced until the content colour of a ([on_color]) stays readable on the result. A gradient end that cannot make initials unreadable: see ui::avatar.
  • fn veil_alpha(&self, alpha: f64) -> f64 — The strength of the Text-coloured veil drawn over a fill-less element in a hover or press state: alpha, held back where text, muted text or an ink that is readable on a surface (or the app bar, or a selected row) would stop being once the veil is on it.
  • fn ink(&self, role: Role) -> Srgb8 — Text-safe variant of a role: Accent, Success, Warning, Danger, Info and TextMuted are nudged in lightness (hue kept) until they meet [Theme::min_text_contrast] (+3 % headroom) on every surface, the app-bar gradient end, a hover veil and a 16 % tint of the role colour (badges). Unchanged when the role already does. Other roles return their colour. Computed once per theme.
  • fn edge(&self) -> Srgb8 — The stroke of a control's boundary (a text field): [Role::Border] moved toward [Role::Text] until it is at least 3:1 (WCAG 1.4.11, +3 % headroom) against the page, a surface and a raised surface. Unchanged when the border already is (the high-contrast themes). Computed once per theme.
  • fn min_text_contrast(&self) -> f64 — The minimum body-text contrast this theme promises (4.5 or 7).
  • fn responsive(&self) -> ui::responsive::Responsive — Breakpoints and compact type scale (see ui::responsive).
  • fn with_responsive(self, r: ui::responsive::Responsive) -> Self
  • ...and 23 more

Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::design::TypeStyle

pub struct TypeStyle { /* see fields */ }

One step of the type scale, in logical pixels.

Public fields

fieldtype
sizef64
weightu16CSS-style weight (400 regular, 600 semibold, 700 bold).
line_heightf64

Methods

  • fn bold(&self) -> bool — True for weights the bold face should render (>= 600).

Trait implementations: Clone, Copy, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::design::TypeTokens

pub struct TypeTokens { /* see fields */ }

One step of the type scale with its letter spacing and its face: the tokens a text of that step draws with.

The tracking is in em (negative is tighter, positive is wider) and the face is the name of a registered face (see [crate::typography::face]).

Public fields

fieldtype
sizef64The size in logical px.
weightu16CSS-style weight (400 regular, 600 semibold, 700 bold).
line_heightf64The line height in logical px.
trackingf64The letter spacing, in em (negative is tighter, positive is wider).
face&'static strThe face the step draws with (the name of a registered face).

Methods

  • fn style(&self) -> TypeStyle — The style of the step (the size, the weight and the line height).
  • fn bold(&self) -> bool — True for the steps whose weight class is the bold one (>= 600).

Trait implementations: Clone, Copy, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::design::color::Oklch

pub struct Oklch { /* see fields */ }

A color in OKLCH: perceptual lightness l (0..1), chroma c, hue h (degrees).

Public fields

fieldtype
lf64
cf64
hf64

Methods

  • fn from_srgb(c: Srgb8) -> Self
  • fn to_srgb(self) -> Srgb8 — Opaque sRGB; chroma is reduced (hue and lightness kept) until it fits.

Trait implementations: Clone, Copy, Debug, PartialEq, StructuralPartialEq

Enums

enumaster_blueprint::design::Ease

pub enum Ease { Linear, Standard, Emphasized, Decelerate, Accelerate, Spring }

One of the theme easing curves.

Variants

  • Linear
  • Standard — Symmetric ease for things that stay on screen.
  • Emphasized — Strong ease-out with a quick start, for hero entrances.
  • Decelerate — Ease-out: things arriving.
  • Accelerate — Ease-in: things leaving.
  • Spring — A slight overshoot, for a control that snaps into place (a switch, a checked box, a slider thumb): it goes a little past and settles back.

Trait implementations: Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd, StructuralPartialEq

enumaster_blueprint::design::Material

pub enum Material { Flat, Neu, Glass }

The material the skin dresses the controls in.

The material is a theme thing: one tree looks right in every theme because the skin resolves the look at render time (see ui::skin). Three materials ship:

  • [Material::Flat] - a flat face, a hairline edge and a hard shadow: the high-contrast themes keep it, because soft effects are noise there;
  • [Material::Neu] - soft UI: raised surfaces carry a light shadow up-left and a dark one down-right, wells and fields are debossed into the page;
  • [Material::Glass] - frosted glass: a translucent face over a blurred, saturated backdrop with a lit rim.

Methods

  • fn name(self) -> &'static str — The token name ("neu", "glass", "flat").

Variants

  • Flat — Flat faces, hairline edges, hard shadows (the high-contrast themes).
  • Neu — Soft UI: extruded raised surfaces, debossed wells.
  • Glass — Frosted glass over a rich backdrop.

Trait implementations: Clone, Copy, Debug, Default, Eq, PartialEq, StructuralPartialEq

enumaster_blueprint::design::Mode

pub enum Mode { Light, Dark }

Light or dark appearance.

Variants

  • Light
  • Dark

Trait implementations: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

enumaster_blueprint::design::MotionDuration

pub enum MotionDuration { Fast, Normal, Slow }

One of the three theme durations.

Variants

  • Fast — State layers, knobs, small popups (120 ms).
  • Normal — Dialogs, toasts, meters (220 ms).
  • Slow — Number tweens, large moves (360 ms).

Trait implementations: Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd, StructuralPartialEq

enumaster_blueprint::design::Radius

pub enum Radius { None, Sm, Md, Lg, Xl, Full }

Corner radius scale steps.

Methods

  • const ALL: [Radius; 6]
  • fn name(self) -> &'static str

Variants

  • None
  • Sm
  • Md
  • Lg
  • Xl
  • Full — Pill. Resolve with [Theme::radius_for] to clamp to half the shorter side.

Trait implementations: Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, StructuralPartialEq

enumaster_blueprint::design::Role

pub enum Role { Background, Surface, SurfaceRaised, Border, Text, TextMuted, Accent, Success, Warning, Danger, Info, OnAccent, OnSuccess, OnWarning, OnDanger, OnInfo, Secondary, OnSecondary }

A semantic color role. The On* roles are the text/icon color to use on top of the matching fill.

Methods

  • const ALL: [Role; 18]
  • fn name(self) -> &'static str — Snake-case token name ("surface_raised").
  • fn on(self) -> Option<Role> — The content color that sits on this fill, if the role is a text-bearing fill.
  • fn resource(self) -> String — Resource name of this role in the node-graph theme (theme.color.accent).

Variants

  • Background
  • Surface
  • SurfaceRaised
  • Border
  • Text
  • TextMuted
  • Accent
  • Success
  • Warning
  • Danger
  • Info
  • OnAccent
  • OnSuccess
  • OnWarning
  • OnDanger
  • OnInfo
  • Secondary
  • OnSecondary

Trait implementations: Clone, Copy, Debug, Eq, From<Role>, Hash, Ord, PartialEq, PartialOrd, RoleExt, StructuralPartialEq

enumaster_blueprint::design::State

pub enum State { Rest, Hover, Press, Focus, Disabled }

Interaction states with a state layer.

Variants

  • Rest
  • Hover
  • Press
  • Focus
  • Disabled

Trait implementations: Clone, Copy, Debug, Eq, Hash, PartialEq, StructuralPartialEq

enumaster_blueprint::design::Style

pub enum Style { Mission, Paper, Contrast }

The overall look of the non-color tokens (radii, type, elevation, density).

Variants

  • Mission — Compact, glowing sci-fi dashboard: medium radii, deep shadows, accent glow.
  • Paper — Soft and airy: large radii, gentle layered shadows, relaxed type.
  • Contrast — Hard-edged and loud: square corners, thick strokes, hard offset shadows.

Trait implementations: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

enumaster_blueprint::design::Type

pub enum Type { Caption, Body, Label, Title, Headline, Display }

The type scale steps.

Methods

  • const ALL: [Type; 6]
  • fn name(self) -> &'static str

Variants

  • Caption
  • Body
  • Label
  • Title
  • Headline
  • Display

Trait implementations: Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, StructuralPartialEq

Functions

fnaster_blueprint::design::contrast

pub fn contrast(a: aster_ui::Srgb8, b: aster_ui::Srgb8) -> f64

WCAG contrast ratio (1.0..=21.0) of two opaque colors.

fnaster_blueprint::design::hex

pub const fn hex(rgb: u32) -> aster_ui::Srgb8

Opaque color from 0xRRGGBB.

fnaster_blueprint::design::mix

pub fn mix(a: aster_ui::Srgb8, b: aster_ui::Srgb8, t: f64) -> aster_ui::Srgb8

Straight sRGB byte mix, per channel including alpha: exactly the arithmetic of the core.color.mix.v1 kernel. t == 0 is a, t == 1 is b.

fnaster_blueprint::design::on_color

pub fn on_color(bg: aster_ui::Srgb8) -> aster_ui::Srgb8

The content color (INK or PAPER) with the better contrast against bg. Always at least about 4.58:1 for any opaque bg.

fnaster_blueprint::design::with_alpha

pub fn with_alpha(c: aster_ui::Srgb8, alpha: f64) -> aster_ui::Srgb8

The same color with a replaced alpha (0.0..=1.0).

fnaster_blueprint::design::color::contrast

pub fn contrast(a: aster_ui::Srgb8, b: aster_ui::Srgb8) -> f64

WCAG contrast ratio (1.0..=21.0) of two opaque colors.

fnaster_blueprint::design::color::ensure_contrast

pub fn ensure_contrast(fg: aster_ui::Srgb8, bg: aster_ui::Srgb8, min: f64) -> aster_ui::Srgb8

Moves fg in OKLCH lightness (hue and chroma kept as far as the gamut allows) until it reaches contrast min against bg.

fnaster_blueprint::design::color::hex

pub const fn hex(rgb: u32) -> aster_ui::Srgb8

Opaque color from 0xRRGGBB.

fnaster_blueprint::design::color::luminance

pub fn luminance(c: aster_ui::Srgb8) -> f64

WCAG relative luminance of the color's RGB (alpha ignored).

fnaster_blueprint::design::color::mix

pub fn mix(a: aster_ui::Srgb8, b: aster_ui::Srgb8, t: f64) -> aster_ui::Srgb8

Straight sRGB byte mix, per channel including alpha: exactly the arithmetic of the core.color.mix.v1 kernel. t == 0 is a, t == 1 is b.

fnaster_blueprint::design::color::on_color

pub fn on_color(bg: aster_ui::Srgb8) -> aster_ui::Srgb8

The content color (INK or PAPER) with the better contrast against bg. Always at least about 4.58:1 for any opaque bg.

fnaster_blueprint::design::color::over

pub fn over(fg: aster_ui::Srgb8, bg: aster_ui::Srgb8) -> aster_ui::Srgb8

fg composited over an opaque bg; the result is opaque.

fnaster_blueprint::design::color::with_alpha

pub fn with_alpha(c: aster_ui::Srgb8, alpha: f64) -> aster_ui::Srgb8

The same color with a replaced alpha (0.0..=1.0).

Constants

constaster_blueprint::design::FULL_RADIUS

pub const FULL_RADIUS: f64

Corner radius used for [Radius::Full] before clamping.

constaster_blueprint::design::MAX_ELEVATION

pub const MAX_ELEVATION: u8

Highest elevation level.

constaster_blueprint::design::color::INK

pub const INK: aster_ui::Srgb8

Near-black and near-white content colors used by [on_color].

constaster_blueprint::design::color::PAPER

pub const PAPER: aster_ui::Srgb8