Lesson 9 of 9
Light Mode vs Dark Mode - Designing for Both
Dark mode has moved from a developer preference to a mainstream user expectation - over 80% of users now use their device in dark mode at least some of the time (Apple Research, 2023). Products that lack dark mode are increasingly perceived as incomplete or underdeveloped. Designing for both modes isn't as simple as inverting colors - it requires a deliberate token architecture and an understanding of how color perception changes on dark surfaces. This topic covers the technical and design approach to building dual-mode products from the ground up.
Why Dark Mode is More Than Color Inversion
Simply inverting light mode colors produces poor dark mode results because color inversion doesn't account for perceptual changes. Pure black backgrounds (#000000) create harsh contrast with content and cause halation - a visual smearing effect where bright elements appear to bleed into the dark background. Good dark mode uses dark gray surfaces, not black. Saturated colors that look vibrant on white look overblown on dark surfaces - dark mode palettes use slightly desaturated versions of brand colors to avoid this. Text that is gray (#666666) on white backgrounds at WCAG AA compliance may need to become lighter (#AAAAAA) in dark mode to maintain the same contrast ratio. Images and shadows work differently: drop shadows are invisible on dark surfaces (shadow is darker than background; on a dark background there's nothing darker). Replace drop shadows with subtle inner borders or elevation conveyed through lighter surface colors. A proper dark mode uses an elevation system: background (darkest), surface-1 (slightly lighter), surface-2 (lighter still), surface-3 (lightest card color). This replicates the light-mode relationship between page background, cards, and elevated elements using lightness instead of shadows.
Light Mode vs Dark Mode - Designing for Both: Visual guide and core principles.
Building a Token-Based Dual-Mode System
- Step 1 - Semantic token architecture: Never hardcode colors in component designs. Instead, reference semantic tokens. A button background uses 'color.primary.default', not '#229c6b'. In light mode, 'color.primary.default' = Blue/500. In dark mode, 'color.primary.default' = Blue/400 (slightly lighter because dark backgrounds make colors appear darker)
- Step 2 - Define surface levels: Light mode surfaces: background=#F8F9FA (almost white), surface-1=#FFFFFF (card), surface-2=#F1F3F5 (nested card/well). Dark mode surfaces: background=#0D1117 (very dark gray, GitHub dark background), surface-1=#161B22 (card), surface-2=#21262D (nested card). Never use pure black (#000) as dark background
- Step 3 - Map every semantic token for both modes: For each semantic token, define two values - one for light mode and one for dark mode. This mapping table is your token file. Examples: text.primary: light=#111827, dark=#F9FAFB. text.secondary: light=#6B7280, dark=#9CA3AF. border.default: light=#E5E7EB, dark=#374151
- Step 4 - Implement in Figma with Variables: Use Figma Variables (2023 feature) to define all semantic tokens with both light and dark mode values. Create a Variable Collection named 'Semantic Tokens'. For each variable, add two modes: 'Light' and 'Dark'. Bind all component properties to semantic variables, then toggle modes to preview both states instantly
- Step 5 - Test both modes: Review every screen in both modes. Check: contrast ratios in both modes (use Stark plugin), shadow/elevation clarity, image contrast, illustration legibility, semantic color meaning (does your error red still look clearly different from your dark surface?)
Practical Exercise - Build a Color & Typography System
# UI Foundations Exercise: Color Palette + Type Scale
# Goal: Define a complete visual foundation for a SaaS app
## PART 1 - COLOR SYSTEM (HSL method)
# PRIMARY COLOR (choose your brand blue)
Primary-500: hsl(217, 91%, 60%) ← main brand color #229c6b
Primary-400: hsl(217, 91%, 70%) ← hover states, lighter
Primary-300: hsl(217, 91%, 80%) ← tinted backgrounds
Primary-600: hsl(217, 91%, 50%) ← pressed states, darker
Primary-700: hsl(217, 91%, 40%) ← text on light bg
# GRAY SCALE (neutral, slightly cool-tinted)
Gray-900: hsl(222, 47%, 11%) ← primary text
Gray-700: hsl(215, 28%, 35%) ← secondary text
Gray-500: hsl(220, 14%, 60%) ← placeholder text
Gray-200: hsl(220, 13%, 91%) ← borders
Gray-50: hsl(210, 40%, 98%) ← page background
# SEMANTIC COLORS
Success: hsl(142, 71%, 45%) ← green #22C55E
Warning: hsl(38, 92%, 50%) ← amber #F59E0B
Error: hsl(0, 84%, 60%) ← red #EF4444
Info: hsl(199, 89%, 48%) ← cyan #06B6D4
# NAMING CONVENTION IN FIGMA
Create Color Styles named:
"Primary/500" → your main blue
"Text/Primary" → Gray-900
"Text/Secondary" → Gray-700
"Surface/Page" → Gray-50
"Border/Default" → Gray-200
## PART 2 - TYPE SCALE (1.25 ratio - Major Third)
Base: 16px (1rem) - body text
Scale multiplier: ×1.25 per step
Label: 12px / 0.75rem - tags, captions, badges
Body SM: 14px / 0.875rem - secondary body, helper text
Body: 16px / 1rem ← BASE
Lead: 20px / 1.25rem - intro paragraphs
H4: 24px / 1.5rem - section sub-headings
H3: 30px / 1.875rem - page section headings
H2: 36px / 2.25rem - major page sections
H1: 48px / 3rem - hero headline
# FONT: Inter (free, Google Fonts)
Weights used:
Regular 400 - body text
Medium 500 - UI labels, nav items
SemiBold 600 - sub-headings, button labels
Bold 700 - H1-H3 headings ONLY
## WCAG CONTRAST REQUIREMENTS
Text on white background:
Normal text (under 18px): minimum 4.5:1 ratio
Large text (18px+ or 14px bold): minimum 3:1 ratio
Check your Primary-500 on white:
#229c6b on #FFFFFF = 3.07:1 (fails for body text!)
Use Primary-600 (#229c6b) for text on white = 4.63:1 ✓
Tool: contrast-ratio.com - check every text+background comboQuick Quiz - UI Design Foundations
Tip
Tip
Practice Light Mode vs Dark Mode Designing for Both in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.
Practice Task
Note
Practice Task - (1) Write a working example of Light Mode vs Dark Mode Designing for Both from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.
Common Mistake
Warning
A common mistake with Light Mode vs Dark Mode Designing for Both is skipping edge case testing - empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready ui ux code.
Key Takeaways
- Dark mode has moved from a developer preference to a mainstream user expectation - over 80% of users now use their device in dark mode at least some of the time (Apple Research, 2023).
- Step 1 - Semantic token architecture: Never hardcode colors in component designs. Instead, reference semantic tokens. A button background uses 'color.primary.default', not '#229c6b'. In light mode, 'color.primary.default' = Blue/500. In dark mode, 'color.primary.default' = Blue/400 (slightly lighter because dark backgrounds make colors appear darker)
- Step 2 - Define surface levels: Light mode surfaces: background=#F8F9FA (almost white), surface-1=#FFFFFF (card), surface-2=#F1F3F5 (nested card/well). Dark mode surfaces: background=#0D1117 (very dark gray, GitHub dark background), surface-1=#161B22 (card), surface-2=#21262D (nested card). Never use pure black (#000) as dark background
- Step 3 - Map every semantic token for both modes: For each semantic token, define two values - one for light mode and one for dark mode. This mapping table is your token file. Examples: text.primary: light=#111827, dark=#F9FAFB. text.secondary: light=#6B7280, dark=#9CA3AF. border.default: light=#E5E7EB, dark=#374151
Finished this lesson?