Customize

Dark Mode

Dark mode is just a token re-declaration. This page covers exactly which tokens the .dark selector overrides — and how to build your own dark palette.

How it works

Dark mode in BIMA is not a separate stylesheet or a set of dark component variants. It is a single rule in variables.css that re-declares a subset of the neutral tokens on the .dark / [data-bima-theme="dark"] selector. Because every component reads its values from those tokens, re-declaring them flips the whole subtree at once.

/* The dark-mode rule in variables.css */
.dark,
[data-bima-theme="dark"] {
  /* surfaces, text, borders, state, status -bg are overridden here */
  /* brand colours are intentionally NOT touched */
}

To simply turn dark mode on, see Getting Started → Dark Mode. This page is about customising which values dark mode uses.

What the dark selector overrides

The dark rule re-declares these token groups — surfaces, text, borders, interaction states, and the status -bg tints. The brand colours (navy, blue, sky) and the status fills / text colours are left at their light-mode values so the brand and AA-compliant status text stay constant.

TokenDark valueGroup
--bima-surface-page #0E1422Surface
--bima-surface-subtle #141B2CSurface
--bima-surface-card #1A2233Surface
--bima-surface-muted #141B2CSurface
--bima-surface-input #1A2233Surface
--bima-surface-input-disabled#11182600Surface
--bima-surface-overlay rgba(3, 8, 18, 0.7)Surface
--bima-text-primary #F8FAFCText
--bima-text-secondary #C3CCDAText
--bima-text-muted #94A3B8Text
--bima-text-disabled #5A6678Text
--bima-text-link var(--bima-sky)Text
--bima-text-link-hover var(--bima-sky-light)Text
--bima-border-default #2A3447Border
--bima-border-strong #3A465CBorder
--bima-border-subtle #232C3DBorder
--bima-state-hover #222C3EState
--bima-state-hover-strong #2A364BState
--bima-state-selected #1E3155State
--bima-row-hover #1F2838State
--bima-success-bg #0E2A24Status -bg
--bima-warning-bg #2E2310Status -bg
--bima-error-bg #2E1414Status -bg
--bima-info-bg #15233AStatus -bg
--bima-neutral-bg #1C2434Status -bg

Note --bima-text-link and --bima-text-link-hover point to the brand sky tokens in dark mode — links shift to the lighter sky so they stay legible on dark surfaces while remaining on-brand. The brand tokens themselves are unchanged.

Live preview

The wrapper below carries class="dark" and a background drawn from the dark --bima-surface-page token. The components inside are the ordinary bima-* classes — they read the dark token values automatically.

Account status

Premium plan

This card reads the dark surface, text, and border tokens. The brand-coloured primary button is identical to light mode.

Renews soon
<div class="dark" style="background:var(--bima-surface-page);padding:1.5rem;border-radius:.75rem">
  <div class="bima-card bima-card--soft">
    <div class="bima-card__header">
      <h3 class="bima-card__title">Account status</h3>
    </div>
    <div class="bima-card__body">
      <button class="bima-btn bima-btn--primary">Manage</button>
      <button class="bima-btn bima-btn--ghost">Cancel</button>
      <span class="bima-badge bima-badge--info">Renews soon</span>
    </div>
  </div>
</div>

A custom dark theme

To tune the dark palette, re-declare the dark tokens on the same .dark selector after importing BIMA. Because your rule is identical in specificity and comes later in the cascade, it wins. Override only the tokens you want to change — everything else keeps BIMA's defaults.

/* 1. Import BIMA (defines the default light + dark tokens) */
@import "@milvikbima/ui/css";

/* 2. Re-declare dark tokens AFTER the import to customise the dark theme */
.dark,
[data-bima-theme="dark"] {
  /* A warmer, slightly lighter dark surface set */
  --bima-surface-page:   #11131A;
  --bima-surface-card:   #1C2030;
  --bima-surface-subtle: #181B26;

  /* Softer dividers */
  --bima-border-default: #2D3344;
  --bima-border-subtle:  #242A38;

  /* Higher-contrast body text */
  --bima-text-secondary: #D2D9E4;
}

Keep brand and status text intact

Avoid overriding the brand tokens (navy / blue / sky) or the status *-text colours inside the dark rule unless you have re-checked contrast. Those text colours are tuned for AA on their tinted backgrounds — change the -bg tint and you may need to re-verify the pairing.

Next steps