Skip to main content

emit_css

Function emit_css 

Source
pub fn emit_css(theme: &Theme, brand_colors: &[BrandColor]) -> String
Expand description

Render a Theme (plus its BrandColor rows) as a <style> block ready to drop into <head>. Emits:

  • :root { … } — surface, semantic, typography, radii, shadow tokens in their light-mode values.
  • [data-theme="dark"] { … } — overrides for dark mode.
  • One block per brand color with raw / rgb / contrast / 50-950.

The returned string is plain HTML; the caller is responsible for rendering it into the <head> (e.g. via Tera or a context var).