Home / Snippets / Color & Theming /
Dark mode skeleton
Shimmer placeholders that stay in the mid-tones—no white flashes on dark dashboards.
Widely Supported
Quick implementation
.dmsk-line {
height: 0.65rem;
border-radius: 6px;
background: linear-gradient(90deg, oklch(0.32 0.02 260), oklch(0.42 0.03 260), oklch(0.32 0.02 260));
background-size: 200% 100%;
animation: dmsk-shimmer 1.2s ease-in-out infinite;
}
@keyframes dmsk-shimmer {
0% { background-position: 100% 0; }
100% { background-position: -100% 0; }
}
Prompt this to your LLM
Motion, a11y, and layout density.
You are building skeleton loading states for a dark-themed product UI.
Goal: Card row with circular avatar + two text lines; shimmer should stay in mid oklch lightness.
Technical constraints:
- Use oklch() for all gradient stops; never pure white fills.
- Add prefers-reduced-motion: replace shimmer with static mid gray.
- Decorative skeleton bits are aria-hidden; container exposes role="status" and concise aria-label.
- Animation must only affect transform/opacity or background-position — avoid layout thrash.
Framework variant A: HTML + CSS.
Framework variant B: React — SkeletonCard with optional line count.
Edge cases:
- Don’t use skeletons for <1s loads — document flash risk.
- Screen readers: avoid spamming live regions; prefer aria-busy on parent in real apps.
- Contrast: ensure shimmer peaks don’t exceed surrounding text contrast needs.
Return HTML + CSS.
Why this matters in 2026
Skeletons set perceived performance. On dark UIs, a bad shimmer reads like a bug—mid-tone oklch ramps keep the illusion polished.
The logic
A wide gradient on a short element, animated via background-position, is cheap to composite. Paired with prefers-reduced-motion, you keep the UI calm for motion-sensitive users.
Accessibility & performance
Treat skeletons as decorative: avoid announcing every line. Use aria-busy on the loading region in production. Keep GPU-friendly properties only.