[ SDK ] /docs/sdk/theme
site/theme
The look. Top-level calls describe the whole look for a run.
import theme from "site/theme"Functions#
| Signature | Description |
|---|---|
fn hue(degrees: i64) -> void | accent colour, 0-359 |
fn weather(kind: Weather) -> void | The backdrop weather. |
fn grid(size: i64) -> void | backdrop grid cell in px, 0 hides it |
fn scanlines(on: bool) -> void | Horizontal scanlines over the backdrop. |
fn glow(level: i64) -> void | 0-100 |
fn mono(on: bool) -> void | the whole page in the mono face |
fn crt(on: bool) -> void | curved-glass vignette and colour fringe |
fn flicker(on: bool) -> void | faint phosphor flicker |
fn invert(on: bool) -> void | Inverts the page colours. The console, palette and toasts are not inverted. |
fn cursor(kind: Cursor) -> void | The pointer style. |
fn scale(percent: i64) -> void | text size, 80-130 |
Types#
enum Weather#
.Clear.Rain.Storm.Snow.Static.Aurora.Matrix
enum Cursor#
.Default.Crosshair.Ring.Trail
Examples#
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: 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