Skip to main content

Module theme

Module theme 

Source

Constants§

MD_BOLD_CLOSE
MD_BOLD_OPEN
Bold text: SGR 1 (bold on). Theme-invariant — bold is an attribute, not a colour.
MD_HEADING_CLOSE
Close heading: bold off + fg default (SGR 22;39). Theme-invariant.
MD_INLINE_CODE_CLOSE
Close inline code: bold off + fg default. Theme-invariant.
MD_ITALIC_CLOSE
MD_ITALIC_OPEN
Italic text: SGR 3 (italic on). Theme-invariant.
MD_MUTED_CLOSE
MD_MUTED_OPEN
Muted / structural chrome (list markers, table borders): bright black / dark grey (SGR 90). The terminal’s profile maps this to a shade with adequate contrast on either background — keep as constant.
RESET
Closes color + italic. Use after every wrapped token span. SGR 23 = italic off, SGR 39 = default foreground.

Functions§

comment
dark: slate gray #7C8499 + italic. light: slate #4A5060 + italic — kept moderately desaturated because comments should read “secondary” relative to the code, not “main attraction.”
function
dark: blue #61AFEF. light: very dark navy #002171 (≥ 14:1 — earlier #0D47A1 at 8.8:1 read “ok but soft”; this is also where the original fn main screenshot regression lived, old #61AFEF at 2.04:1 made main invisible).
is_light_for_render
render/alt_screen.rs reads this to swap the session-name pill SGR (reverse + bright cyan on dark; bold + standard magenta on light). Named so the call site documents intent; behaviourally identical to is_light_for_highlight.
keyword
dark: soft purple #C678DD. light: very dark violet #4A0072 (≥ 13:1 on white — earlier #7B1FA2 at 8.7:1 read soft on Mac Terminal where colours render less crisp than iTerm2).
md_heading_open
Heading H1-H3. dark: bold + bright cyan (SGR 1;96, matches Palette::ACCENT). light: bold + bright blue (SGR 1;94) — bright cyan renders too pale on white in most light-theme terminal profiles; blue still maps to a dark, readable variant on light profiles.
md_inline_code_open
Inline code. dark: bold + bright cyan (matches headings). light: bold + standard magenta (SGR 1;35) — distinct from headings, terminal profiles map 35 to a dark magenta that’s readable on white.
number
dark: amber #D19A66. light: dark chestnut #663300 (≥ 11:1).
punctuation
Both palettes intentionally use terminal default fg.
set_theme_mode
Switch the palette. Idempotent. Call once during startup before the first markdown / highlight emission.
string
dark: green #98C379. light: dark green #006400 (≥ 13:1 — greens read soft at any given luminance, so light pushes past the other tokens’ contrast budget to compensate).
type_color
dark: sand #E5C07B. light: dark walnut #5B3A00 (≥ 11:1) — distinct hue from number’s chestnut so type names don’t visually collide with literals on a line like let x: U32 = 42.
variable
Both palettes intentionally use terminal default fg.