Site Colors & Section Modifiers
Micropage has a built-in default primary color that works out of the box.
You can override it with a custom brand color in [site] and optionally
set a different dark-mode value in [site.dark]. The primary color —
default or custom — can be applied to any section, container, or hero
via modifier tokens on the section header line.
Defining colors
Colors are declared inside an indented colors: block within the [site]
(and optionally [site.dark]) block.
[site]
title: My Brand
colors:
primary: #5c6fff
secondary: #6c757d
success: #198754
warning: #ffc107
info: #0dcaf0
danger: #dc3545
[site.dark]
colors:
primary: #8ba2ff
success: #2ea043
Supported keys (all optional): primary, secondary, success, warning, info, danger. Use #rrggbb or #rgb hex values. Invalid hex for a key is ignored for that key only.
- If no
colors:block is defined, the built-in default colors apply. Other semantic colors come from Bootstrap until you override them here. [site.dark]acceptscolors:andlogo:. It does not affect title or any other site setting. You can override any of the same color keys for dark mode, and optionally provide a separate logo for dark mode (see Dark-mode logo below).[site.dark]values apply automatically when the visitor's system preference is dark mode (viaprefers-color-scheme: dark). There is no manual toggle.- A
primaryset in[site]applies in light mode only; dark mode uses[site.dark]primaryif set, otherwise the dark defaults for primary, links, and buttons. Other[site]colors apply in both modes unless[site.dark]overrides them. - Dark mode follows the visitor's OS setting through CSS only; published pages do not set a
data-bs-themeattribute. In custom CSS (for example in a/// htmlblock), target dark mode with@media (prefers-color-scheme: dark) { … }, not a[data-bs-theme="dark"]selector. - Every key you set also gets a text color for that background (
--mp-{name}-contrast), picked by the contrast rule. Forprimary, the link color is that hex mixed toward black (light mode) or white (dark mode) only as far as it needs to reach 4.5:1 on the page, muted bands, the hero glow and form cards. Link hover is 10% darker, or 10% lighter where darker would fail. Icon blocks, pagination and link-style buttons use the link color too; filled buttons keep the hex as chosen.
Default colors
| Role | Light | Dark |
|---|---|---|
| Primary | #3347d1 | #7f98ff |
Text on bg:primary | #ffffff | #111111 |
| Link | #3347d1 | #8ba2ff |
| Link hover | #2a3bb0 | #abc0ff |
| Primary and submit button | #3347d1 | #4f69ec |
| Primary button hover (the submit button doesn't change) | #2a3bb0 | #4361ee |
| Primary and submit button label | #ffffff | #ffffff |
| Secondary text | #505868 | #a6b0c2 |
Generated CSS variables
For primary (when set):
| Variable | Value |
|---|---|
--mp-primary | The hex value |
--mp-primary-rgb | Comma-separated R, G, B |
--mp-primary-contrast | #ffffff, #111111, or #000000, by the contrast rule |
--bs-primary | Overrides Bootstrap's primary |
--bs-primary-rgb | Overrides Bootstrap's primary RGB |
--bs-link-color | Primary, adjusted to reach 4.5:1 on the template's backgrounds |
--bs-link-hover-color | Link color darkened 10%, or lightened 10% if darkening would fail |
--mp-btn-primary-bg | The hex value |
--mp-btn-primary-hover-bg | Primary darkened 10%, or lightened 10% if darkening would take the label below 4.5:1 |
--mp-btn-primary-color | Same value as --mp-primary-contrast |
For each semantic key you set (including primary), the preview also injects Bootstrap 5.3–style derived variables using CSS color-mix against the current theme background, border, and body text:
| Variable pattern | Role |
|---|---|
--bs-{name}-bg-subtle | Tinted background (e.g. alerts, soft strips) |
--bs-{name}-border-subtle | Tinted border |
--bs-{name}-text-emphasis | Text on subtle backgrounds: 40% of the color mixed with the body text color |
These are computed, not authored in markup; they update when light/dark theme switches because they reference --bs-body-bg, --bs-border-color, and --bs-body-color.
Section bg:primary-subtle uses var(--bs-primary-bg-subtle) (Bootstrap default when you do not set primary, or the generated value when you do).
Theme variables
These are set on every site, whatever colors you choose:
| Variable | Value |
|---|---|
--mp-field-border | Border of fields, checkboxes and radios inside forms: #687182 in light mode, #7d8799 in dark. Separate from --bs-border-color. |
Accessibility
Primary buttons, submit buttons, and bg: sections in a color you set all use one rule for the text on that color:
#ffffffif it reaches 4.5:1, the WCAG AA ratio for normal text.- Otherwise
#111111if that reaches 4.5:1. - Otherwise
#000000, which always does when white doesn't.
How it applies:
- Sections: muted text uses the same color at full strength.
- Primary and submit buttons: the submit button has the primary button's fill and label in both light and dark mode, and keeps that fill on hover and press. With a custom
primary, the primary button's hover is 10% darker, or 10% lighter when darker would take the label below 4.5:1. - Other filled buttons:
btn-secondary:,btn-info:,btn-warning:, andbtn-danger:keep Bootstrap's fill and label. Your colors and the rule above don't apply to them. - Outline buttons:
btn-outline:follows the section's text color at rest. On hover it shows a 2px outline in that color. On keyboard focus it shows the same 3px focus outline as every other button.btn-outline-success:,btn-outline-danger:,btn-outline-info:, andbtn-outline-warning:take the section's text color as their label at rest only. On hover, keyboard focus, and press they use Bootstrap's fill and label, and keyboard focus adds the outline. Their border always stays Bootstrap's color, even if you set that color. - Links: a custom
primaryis adjusted for link text so it reaches 4.5:1 on the template's own backgrounds. A background you set yourself, such as a colored section or custom CSS, is not taken into account, so check links there.
text: on icons vs sections
The same spelling text: is used in two different places:
- Section / hero / container (see below):
text:lightortext:darkonly — fixed light or dark text on the section frame. icon:lines (see Components & Aliases):text:primary,text:success,text:body-secondary, etc. — these map to Bootstrap text color utilities (text-primary,text-body-secondary, …) and use your site semantic colors when overridden.
Section modifiers
Modifiers are space-separated key:value tokens appended to the section header
line after the section type. They work on section, container, and hero
sections. The navbar is not a section and does not support modifiers.
/// section bg:primary
/// hero bg:primary align:center
/// section bg:dark text:light
/// section align:center
The bare token center is also accepted as shorthand for align:center:
/// section center
bg: — background color
| Token | Background |
|---|---|
primary | var(--mp-primary) |
primary-subtle | var(--bs-primary-bg-subtle) (Bootstrap default or generated from your primary) |
secondary | var(--bs-secondary) |
success | var(--bs-success) |
warning | var(--bs-warning) |
info | var(--bs-info) |
danger | var(--bs-danger) |
dark | var(--bs-dark) |
light | var(--bs-light) |
muted | var(--bs-secondary-bg) |
text: — explicit text color
| Token | Color |
|---|---|
text:light | #ffffff |
text:dark | #111111 |
When text: is omitted:
bg:primary→ uses--mp-primary-contrast(by the contrast rule; with the default primary, white in light mode and#111111in dark mode)bg:secondary,bg:success,bg:danger→--mp-{name}-contrastif you set that color, otherwise whitebg:info,bg:warning→--mp-{name}-contrastif you set that color, otherwise#111111bg:dark→ whitebg:light→#111111bg:primary-subtle→ the body text color, used for muted text toobg:muted→ no override
text:light and text:dark are fixed colors. bg:primary-subtle and bg:muted change in dark mode, so a fixed text color on them is unreadable in one mode. The same goes for bg:primary with the default primary: text:dark is unreadable on it in light mode, and text:light in dark mode. Leave text: out on those sections.
align: — column alignment
| Token | Effect |
|---|---|
align:center | Columns align vertically to center (align-items-center) |
| (omitted) | Columns align to the top (align-items-start) |
Top alignment is the default, which gives a better result for unequal-height
cards and pricing grids. Use align:center for image-and-text split layouts.
Dark-mode logo
[site.dark] also accepts a logo: directive. When both a light logo (in [site]) and a dark logo (in [site.dark]) are set, the renderer emits a <picture> element so the browser swaps logos automatically based on prefers-color-scheme.
[site]
logo: <- logo.svg
[site.dark]
logo: <- logo-dark.svg
colors:
primary: #8ba2ff
Behavior summary:
- Both logos set →
<picture>swap viaprefers-color-scheme: dark. - Light logo only → single
<img>(existing behavior, unchanged). - Dark logo only → dark logo rendered unconditionally (valid but unusual).
- Neither → site title text fallback (existing behavior).
Both logos should share an aspect ratio — or both carry explicit width/height — to prevent layout shift on theme change. The rendered <img> height is fixed at 32 px.
Full example
[site]
title: Color System Demo
description: Demonstrating bg:, text:, and align: modifiers
colors:
primary: #5c6fff
[site.dark]
colors:
primary: #8ba2ff
[nav]
Home -> /
[Home -> /]
/// hero bg:primary
h1: Welcome to My Brand
p: This hero uses the primary brand color as background.
button: Get started -> /signup
/// section bg:primary-subtle
h2: Primary subtle
p: Soft primary-tinted background — great for alternating sections.
/// section
h2: Default (top-aligned columns)
p: No bg modifier. Columns align at the top.
col:
h3: Card A
p: Short.
col:
h3: Card B
p: Longer content that stays top-aligned.
/// section bg:dark text:light
h2: Dark background
p: Explicit text:light for contrast.
/// section bg:success
h2: Bootstrap semantic token
p: success, warning, info, danger, dark, light work without any custom color config.
/// section align:center
h2: Center-aligned columns
p: Use for image-and-text split pairs.
col:
img: <- workspace.jpg
col:
h3: Paired with image
p: Vertically centred next to the image.