How to Fix Boring UIs with Depth

Learn how to add visual depth to flat UIs using layered shades, shadows, and highlights. Build sophisticated dark interfaces with this interactive guide.

Why Flat UIs Feel Boring

Flat design is clean, but taken too far it becomes lifeless. Everything sits on the same plane, nothing stands out, and the interface feels like a spreadsheet.

Depth solves this by mimicking how the real world works: objects at different distances have different brightness, shadows, and clarity. In UI terms, this means creating layers — a background, a surface, and elevated elements — each slightly different in color.

3-4 Shades of the Same Color

The foundation of depth is having multiple shades of your background color. Pick one hue (or go neutral) and create 3-4 lightness steps: 5% for the deepest background, 10% for cards, 15% for elevated surfaces, and 20% for popovers or tooltips.

The key insight: lighter means elevated. Lighter means more important. This creates a natural hierarchy without borders or shadows — the shade alone communicates depth level.

Interactive Demo
Depth Layers
L1
L2
L3
L4
Before / After
Flat
With Depth
CSS Output
:root {
  --layer-1: hsla(220, 10%, 5%, 1);
  --layer-2: hsla(220, 10%, 13%, 1);
  --layer-3: hsla(220, 10%, 22%, 1);
  --layer-4: hsla(220, 10%, 30%, 1);
  --shadow: 0 6px 12px 0px hsla(220, 20%, 2%, 0.35000000000000003), 0 3px 4px 0px hsla(220, 30%, 1%, 0.45);
}

Use 3-4 shades of the same hue for layers. Lighter = elevated = important. Combine a small dark shadow with a larger diffuse one for realistic depth.

The Two-Shadow Technique

Realistic shadows use two layers: a small, dark, tight shadow (simulates the contact point) combined with a larger, softer, lighter shadow (simulates ambient occlusion).

For example: 0 2px 4px rgba(0,0,0,0.3) plus 0 8px 24px rgba(0,0,0,0.15). The first creates crispness, the second creates atmosphere. Together they look far more natural than a single shadow.

*

For dark UIs, shadows need to be much darker to be visible — use 0.2-0.4 alpha instead of the 0.05-0.15 you'd use on light backgrounds.

Highlights and Inset Shadows

The secret sauce of polished UIs: a subtle top highlight. Add a 1px highlight or a gradient from white/4% to transparent along the top edge of elevated elements. This simulates light hitting the raised surface from above.

Inset shadows work the opposite way — they make elements feel recessed, like inputs, wells, or deactivated states. Use inset 0 2px 4px rgba(0,0,0,0.2) for a subtle pressed-in effect.

Key Takeaways

Use 3-4 shades of the same hue for depth layers (5%, 10%, 15%, 20% lightness)
Lighter = elevated = more important in the visual hierarchy
Combine a small+dark shadow with a larger+soft shadow for realism
Add a subtle top highlight (white at 3-5% opacity) to elevated elements
Use inset shadows for recessed elements like inputs
Dark mode shadows need higher opacity (0.2-0.4) to be visible

Related Guides & Tools

Want the full picture?

This free tool checks one slice of UX. Picopi audits your entire page — issues, screenshots, and fixes — web or mobile.