0Pricing
SwiftUI Academy · Lesson

Adapting to Light & Dark Mode

Use semantic colors for both appearances.

Two Appearances

iOS offers Light and Dark Mode, and users switch any time. A polished app looks great in both without extra effort.

Use Semantic Colors

Reach for semantic colors like Color.primary or Color(.systemBackground). They flip automatically between appearances.

Text("Title")
    .foregroundStyle(.primary)
    .background(Color(.systemBackground))

All lessons in this course

  1. VoiceOver & Accessibility Labels
  2. Dynamic Type & Scaled Fonts
  3. Localizing Strings & String Catalogs
  4. Adapting to Light & Dark Mode
← Back to SwiftUI Academy