Themes
svblock uses CSS custom properties (variables) for all visual styling of the generated SVG diagrams. Four built-in themes are provided, and custom themes can be defined in TOML or YAML files.
Built-in Themes
Select a theme with the --theme CLI option:
svblock module.sv --theme dark
- default
Light background with colored pins. Blue inputs, red outputs. Good for general use and embedding in documentation.
- dark
Dark background inspired by Catppuccin. Pastel-colored pins on a dark surface. Suitable for dark-mode documentation or presentations.
- minimal
Monochrome – all pins use the same gray color. Clean look for formal documentation where color coding is not needed.
Pure black-and-white. Designed for printing and high-contrast display.
CSS Variables
Every theme defines the following 12 CSS custom properties:
Variable |
Purpose |
Default Value |
|---|---|---|
|
Diagram background color |
|
|
Box border color |
|
|
Module name text color |
|
|
Input pin & label color |
|
|
Output pin & label color |
|
|
Inout pin & label color |
|
|
Interface pin & label color |
|
|
Group separator background |
|
|
Group label text color |
|
|
Bus pin stroke width (unitless) |
|
|
Header/title bar background |
|
|
Parameter text color |
|
Custom Themes
Create a TOML or YAML file that overrides any subset of the CSS variables. Values
you don’t specify are inherited from the default theme.
TOML Format
# my_theme.toml
[theme]
"--sym-bg" = "#f5f5dc"
"--sym-border" = "#8b4513"
"--sym-pin-input" = "#006400"
"--sym-pin-output" = "#8b0000"
"--sym-header-bg" = "#deb887"
YAML Format
# my_theme.yaml
theme:
"--sym-bg": "#f5f5dc"
"--sym-border": "#8b4513"
"--sym-pin-input": "#006400"
"--sym-pin-output": "#8b0000"
"--sym-header-bg": "#deb887"
Use the custom theme:
svblock module.sv --theme my_theme.toml
Note
Both flat and nested formats are supported. The [theme] / theme:
key is optional – you can also put the variables at the top level.
YAML support requires pyyaml. TOML is supported natively on Python 3.11+;
on Python 3.10, install tomli.
Theme in Sphinx
The Sphinx directive also accepts themes:
.. svblock:: path/to/module.sv
:theme: dark