Prohlížeč zdrojového kódu
docs/specs/styling.md
Spec: Styling and CSS
- Status: active
- Created: 2026-03-05
- Related code:
app/assets/stylesheets/,app/javascript/controllers/theme_controller.js,app/views/layouts/application.html.erb
Overview
The app uses Pico CSS v2 as a base design system, extended with custom SCSS partials compiled by Dart Sass via Sprockets. The styling system provides a consistent visual theme across all pages, supports both light and dark modes, and handles syntax highlighting for code display.
Behaviour
Stylesheet compilation
application.scssis the entry point; it loadspico.min.cssvia a Sprocketsrequiredirective, then@uses all SCSS partials.- Partials are:
variables,layout,cards,code,results,home,rouge,source. - Compilation is handled by
dartsass-sprockets(no separate Sass watcher process needed).
Typography
- Inter (from Bunny Fonts CDN) is the sans-serif font; a monospace stack (SF Mono → Cascadia Code → Fira Code → Consolas) is used for code.
- Fonts are loaded via
<link>in the layout head.
Dark mode
data-theme="light|dark"on<html>drives all theme CSS. See themes.md for full behaviour.
Custom tokens
_variables.scssoverrides Pico CSS custom properties at matching specificity to avoid!important.- Custom tokens for result boxes (
--color-result-ok-*,--color-result-err-*) are defined for both light and dark in_variables.scss.
Syntax highlighting (Rouge)
rouge.scssprovides GitHub Light colour rules for.highlight(default) and GitHub Dark rules under[data-theme="dark"] .highlight.
Page-specific partials
_layout.scss— sticky footer (flex body), flash message styles_cards.scss—.tag,.tag-filter,.tag-filters,.examples-grid(auto-fill grid)_code.scss—.code-blockwith scrollable<pre>_results.scss—.result-box(success/error variants),.result-meta_home.scss—.herocentred section_source.scss— two-column source browser layout, sticky tree sidebar,.tree-fileactive state, responsive collapse at <=768px
Conventions
- Custom styles prefer Pico CSS variables (
--pico-*) over hardcoded values where an equivalent exists. - No utility-class frameworks (no Tailwind/Bootstrap).
- The scenario form uses bare
<label>+<select>pairs without wrapper divs.
Implementation Notes
pico.min.cssis vendored inapp/assets/stylesheets/and loaded via Sprocketsrequire(not@use) because it is plain CSS, not SCSS.- Dart Sass is provided by
dartsass-sprocketsgem; no separate watcher process is needed in development. _variables.scssuses:root:not([data-theme="dark"]), [data-theme="light"]to match Pico's own specificity (0,2,0) so overrides win by source order without!important.- Theme switching implementation details are in themes.md.
Tests
No automated tests — visual styling is verified manually.
See Also
- Home Page —
_home.scssstyles the hero section;_cards.scssstyles the examples preview grid. - Source Browser —
_source.scssprovides all Source Browser layout and tree styles. - Examples Runner —
.result-boxand.code-blockare the primary styled outputs of the runner. - Light/Dark Theme Switching — detailed spec for the theme toggle behaviour and persistence.
- Markdown Code Block Syntax Highlighting — uses
rouge.scsscolour rules for code blocks inside rendered Markdown.
Change Log
- 2026-03-05: Retrospective spec written documenting current state.