Design system¶
indah ships one look, called Studio, and styles every component through a small set of named design tokens (CSS custom properties). You never restyle a component. You change a token, and every component that uses it follows. This page is the contract: what the tokens are, what each is for, and how to override them.
The role names follow Material Design 3 (primary, on-primary, container, outline, surface), because that vocabulary is well understood. The values and the look are indah's own: warm porcelain, bougainvillea magenta, deep teal.
Overriding tokens¶
indah.create_app(
theme=indah.Theme(
light={"primary": "#1f6feb"},
dark={"primary": "#79b8ff"},
radius="8px",
font="system-ui, sans-serif",
),
density="compact",
)
Only the colour roles below can be overridden, per scheme (light and dark). radius and
the fonts apply to both. font sets the display and body stacks together; for three typefaces use
font_display (headings), font_body (running text) and font_mono (code, numbers, table
headers), each one CSS font stack. A slot wins over font for its own token. An unknown token name raises an error, so a typo cannot pass silently.
If you override a *-container role, also override its on-*-container partner so the text
stays readable. The Bunga logo is brand identity, not a theme role: a theme never recolours
it. To use your own mark, pass logo=. A mark that vanishes on one background needs a pair:
logo=(light_mark, dark_mark) shows the one that matches indah's light/dark toggle (an SVG that
relies on currentColor does not work, since the logo is shown in an <img>).
Try it live. Nothing downloads until you press Run it.
x- tokens, radius, font, density and frame width.import indah
theme = indah.Theme(
light={"primary": "#d6336c", "primary-container": "#ffe3ec"},
dark={"primary": "#ff8fb3", "primary-container": "#5c1630"},
radius="2px",
font="Georgia, serif",
# the app's own tokens: named x-<name>, read as var(--x-brand) in your CSS
extra_light={"x-brand": "#d6336c"},
extra_dark={"x-brand": "#ff8fb3"},
)
app = indah.create_app(
session_factory=build,
theme=theme,
density="compact", # or "comfortable" (the default): table row height and padding
max_width="720px", # the page frame; "none" for full width
) Loads about 9 MB, then runs in your browser. Open in the Studio (make demo, then c/layout/theming)
Your own fonts¶
fonts= ships typefaces with the app. Each Font is woff2 bytes or the path of a .woff2 file,
read once when the theme is built. indah serves the file from your app's own address (cached for a
year, named by its content, so a changed file is a new URL) and writes the @font-face rule with
font-display: swap. The page never asks another host for a font, and the CSP needs no change.
indah.Theme(
fonts=[
indah.Font("Bricolage Grotesque", "fonts/bricolage.woff2", weight="200 800"),
indah.Font("Hanken Grotesk", "fonts/hanken.woff2", weight="100 900"),
indah.Font("IBM Plex Mono", "fonts/plex-mono.woff2"),
],
font_display="'Bricolage Grotesque', system-ui, sans-serif",
font_body="'Hanken Grotesk', system-ui, sans-serif",
font_mono="'IBM Plex Mono', ui-monospace, monospace",
)
family is the name to use in a stack. weight is "400" or a variable font's range such as
"100 900"; style is "normal" or "italic". A URL, a file that is not woff2, a file over 2 MiB,
more than 8 fonts or the same family, weight and style twice raises an error when the app is built.
Keep a fallback in each stack: until the file arrives the browser shows it, then swaps.
Your own tokens¶
An app can add roles the core set does not have, such as a row-hover fill or a status colour.
Name them x-<name> and pass them per scheme; they are emitted as --x-<name> for your CSS
to read (a custom component's styles, for example).
indah.Theme(
extra_light={"x-brand": "#b5296b", "x-row-hover": "rgba(0, 0, 0, 0.04)"},
extra_dark={"x-brand": "#ff7ab6", "x-row-hover": "rgba(255, 255, 255, 0.06)"},
)
Define a token in both schemes if it should differ, because one set only in extra_dark has no
value in light. Values are checked like any other theme value. The core roles stay a closed
set: Theme(light={"x-brand": ...}) raises, and so does an extra that does not start x-.
Your own stylesheet¶
Tokens cannot express a media query. css= takes the app's own rules, as a pathlib.Path (read
once, when the app is built) or a str of CSS:
indah.Theme(css=Path("app.css"))
indah.Theme(css="@media (max-width: 600px) { .my-card { padding: 4px; } }")
The sheet is emitted after the token overrides, in the same <style> indah already adds, so it
wins over them and works under csp="strict" with no unsafe-inline and no custom component. A
bare file name as a str raises (wrap it in Path), as does a `