Dark Mode CSS Architecture
/* ── 3-Layer Dark System ──────────────── */
:root {
/* Backgrounds */
--bg: #06080f; /* page background */
--card: #0d1117; /* card surface */
--elevated: #161b22; /* tooltip, dropdown */
/* Borders */
--border: rgba(255,255,255,.07);
/* Text hierarchy */
--t1: #f1f5f9; /* headings */
--t2: rgba(255,255,255,.55); /* body */
--t3: rgba(255,255,255,.30); /* captions */
/* Accent */
--accent: #a78bfa; /* swap this one variable to rebrand */
}
Glassmorphism Dark Cards — CSS
/* Glassmorphism card on dark background */
.glass-card {
background: rgba(255,255,255,.05);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid rgba(255,255,255,.10);
border-radius: 16px;
padding: 24px;
}
Frequently Asked Questions
What is a dark website template?
A dark website template uses a dark background (typically #06080f to #111827) with light text and a coloured accent. Dark UI is popular for SaaS products, developer tools, fintech, and creative agencies. UIXDraft includes 50+ dark HTML templates with a 3-layer depth system and CSS custom property token architecture for easy rebranding.
Is dark mode better for websites?
Dark mode performs better for: developer tools (matches users' IDE environment), SaaS dashboards (reduces eye strain), fintech/trading platforms (professional aesthetic), and creative portfolios (artwork pops on dark backgrounds). Light mode performs better for: content-heavy sites, news/blogs, e-commerce (product photos look better on white), and healthcare (clinical trust).
How do I create a dark website in HTML and CSS?
Use a CSS custom property token system: define `--bg:#06080f`, `--card:#0d1117`, `--t1:#f1f5f9`, `--t2:rgba(255,255,255,.55)`, `--border:rgba(255,255,255,.07)`, and one accent colour. Apply these tokens to all elements. To support both dark and light mode, use `@media(prefers-color-scheme:light)` to redefine the tokens. UIXDraft templates include this architecture pre-built.
What colour accent works best on a dark website?
Best dark UI accent colours by industry: Purple (#a78bfa) — SaaS, agency, portfolio. Blue (#38bdf8) — fintech, enterprise. Green (#34d399) — finance, growth products. Yellow/gold (#fbbf24) — premium, creative. Red/coral (#f87171) — gaming, entertainment, alerts. All need a contrast ratio of at least 4.5:1 against the background for WCAG AA compliance.
How do I add glassmorphism to a dark website?
CSS glassmorphism: `background: rgba(255,255,255,.05); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,.10); border-radius: 16px`. Works best when there's a gradient or image behind the element to blur. On a flat dark background, use a slightly lighter card colour instead — true glassmorphism requires a complex background to be visible.