Skip to content

Docs menu // site/theme

[ SDK ] /docs/sdk/theme

site/theme

The look. Top-level calls describe the whole look for a run.

import
import theme from "site/theme"

Functions#

SignatureDescription
fn hue(degrees: i64) -> voidaccent colour, 0-359
fn weather(kind: Weather) -> voidThe backdrop weather.
fn grid(size: i64) -> voidbackdrop grid cell in px, 0 hides it
fn scanlines(on: bool) -> voidHorizontal scanlines over the backdrop.
fn glow(level: i64) -> void0-100
fn mono(on: bool) -> voidthe whole page in the mono face
fn crt(on: bool) -> voidcurved-glass vignette and colour fringe
fn flicker(on: bool) -> voidfaint phosphor flicker
fn invert(on: bool) -> voidInverts the page colours. The console, palette and toasts are not inverted.
fn cursor(kind: Cursor) -> voidThe pointer style.
fn scale(percent: i64) -> voidtext size, 80-130

Types#

enum Weather#

.Clear.Rain.Storm.Snow.Static.Aurora.Matrix

enum Cursor#

.Default.Crosshair.Ring.Trail

Examples#

A complete look
import theme from "site/theme"

theme.hue(150)
theme.weather(.Aurora)
theme.grid(32)
theme.scanlines(false)
theme.glow(70)
theme.mono(false)
theme.crt(true)
theme.flicker(false)
theme.invert(false)
theme.cursor(.Ring)
theme.scale(110)

Limits#

  • hue wraps around 360. grid is clamped to 16-160 px, and 0 hides it. glow is clamped to 0-100 and scale to 80-130.
  • theme.invert and theme.flicker count against the 2-per-second flash budget (extra flips are dropped). With prefers-reduced-motion set, flicker is ignored, and invert only changes when the visitor caused it (a key, the palette or Run), not from a timer or event.
  • A look is described by the top level of a script: each run starts from the default look, so a theme call inside a callback changes the live page but is gone at the next run.

Declaration file#

This page is generated from the file below, served as /eitri/sdk/site/theme.eith. Types and signatures are exactly what the compiler checks scripts against. Back to all modules.

site/theme.eith
// site/theme: the look. Top-level calls describe the whole look for a run.

pub enum Weather {
    Clear
    Rain
    Storm
    Snow
    Static
    Aurora
    Matrix
}

pub enum Cursor {
    Default
    Crosshair
    Ring
    Trail
}

pub fn hue(degrees: i64) -> void            // accent colour, 0-359
pub fn weather(kind: Weather) -> void
pub fn grid(size: i64) -> void              // backdrop grid cell in px, 0 hides it
pub fn scanlines(on: bool) -> void
pub fn glow(level: i64) -> void             // 0-100
pub fn mono(on: bool) -> void               // the whole page in the mono face
pub fn crt(on: bool) -> void                // curved-glass vignette and colour fringe
pub fn flicker(on: bool) -> void            // faint phosphor flicker
pub fn invert(on: bool) -> void
pub fn cursor(kind: Cursor) -> void
pub fn scale(percent: i64) -> void          // text size, 80-130