Logo for tanaschita.com

Supporting Differentiate Without Color in SwiftUI

Learn how to communicate status with symbols and shapes instead of relying on color alone.

12 Oct 2026 · 4 min read

Color can make the state of an interface easy to recognize at a glance. But if color is the only difference between two states, that information may not be available to everyone.

In this article, we'll use SwiftUI's accessibilityDifferentiateWithoutColor environment value to add a second visual cue when the corresponding system setting is enabled.

Sponsorship logo
Architecture & Design Patterns for iOS
This book is a practical guide to essential architectural principles and design patterns for iOS development. It covers strategies for building maintainable apps with Swift and SwiftUI, including dependency injection, navigation, common patterns, and modularization.
LEARN MORE

Starting with a color-only status

Suppose we use a colored circle to show whether something is available:

Circle()
.fill(isAvailable ? .green : .red)
.frame(width: 28, height: 28)
.accessibilityLabel(
isAvailable ? "Available" : "Unavailable"
)

The accessibility label communicates the state to assistive technologies such as VoiceOver, but the visible interface still relies entirely on the difference between green and red.

We can make the two states visually distinct by adding a checkmark or an xmark when the user asks the system to differentiate without color.

Reading the system preference

Users can enable Differentiate Without Color in the Settings app under Accessibility → Display & Text Size → Differentiate Without Color.

SwiftUI exposes that preference as a Boolean environment value:

@Environment(\.accessibilityDifferentiateWithoutColor)
private var differentiateWithoutColor

Because it is an environment value, SwiftUI updates views that read it when the setting changes.

Adding a second visual cue

We can now overlay a symbol when the preference is enabled:

struct AvailabilityIndicator: View {
@Environment(\.accessibilityDifferentiateWithoutColor)
private var differentiateWithoutColor
let isAvailable: Bool
var body: some View {
Circle()
.fill(isAvailable ? .green : .red)
.frame(width: 28, height: 28)
.overlay {
if differentiateWithoutColor {
Image(systemName: isAvailable ? "checkmark" : "xmark")
.font(.caption.bold())
.foregroundStyle(.white)
}
}
.accessibilityLabel(
isAvailable ? "Available" : "Unavailable"
)
}
}

With the setting disabled, the indicator keeps its original appearance. With the setting enabled, its meaning no longer depends on distinguishing the two colors.

Depending on the interface, the additional cue can also be a text, different shapes, patterns or a change in position may communicate the distinction more clearly.

Designing beyond the preference

Depending on the design, it may also make sense to show the checkmark and xmark by default. This makes the states distinguishable without color for everyone and removes the need for a conditional adaptation.

accessibilityDifferentiateWithoutColor is useful when the additional visual cue works better as an alternative presentation, for example when symbols would otherwise add too much visual density to a compact interface.

Testing both appearances

We can use previews to compare the indicator with the preference disabled and enabled:

#Preview("Default appearance") {
HStack(spacing: 20) {
AvailabilityIndicator(isAvailable: true)
AvailabilityIndicator(isAvailable: false)
}
.padding()
}
#Preview("Differentiate without color") {
HStack(spacing: 20) {
AvailabilityIndicator(isAvailable: true)
AvailabilityIndicator(isAvailable: false)
}
.padding()
.environment(\.accessibilityDifferentiateWithoutColor, true)
}

When testing the settings on a device or simulator, Xcode's Accessibility Inspector can override Differentiate Without Color as well, which makes it useful for checking several screens without repeatedly changing the system setting.

A grayscale color filter can reveal places that rely heavily on color, but it isn't a simulation of how every person with a color vision difference sees the interface. It is a useful additional check, not a replacement for providing another visual cue.

Conclusion

SwiftUI's accessibilityDifferentiateWithoutColor environment value tells us whether the user enabled the corresponding system setting. We can use it to provide an alternative presentation with symbols, shapes, text or other visual cues.

Sponsorship logo
Preparing for a technical iOS job interview
Preparing for a technical iOS Job Interview with over 300 questions & answers. Covering Swift & Objective-C, SwiftUI & UIKit, Combine, HTTP Networking, iOS File System, Core Data, Concurrency with async/await, Security, Automated Testing, Dependency Management, AI & Machine Learning and more.
LEARN MORE
Sponsorship logo
Architecture & Design Patterns for iOS
This book is a practical guide to essential architectural principles and design patterns for iOS development. It covers strategies for building maintainable apps with Swift and SwiftUI, including dependency injection, navigation, common patterns, and modularization.
LEARN MORE
Sponsorship logo
Become a sponsor of tanaschita.com
By publishing an article on different iOS topics every week, tanaschita.com is constantly growing in the developer community and may provide a great audience for you as a sponsor.
CLICK TO LEARN MORE

Newsletter

Image of a reading marmot
Subscribe

Like to support my work?

Say hi

Related tags

Articles with related topics

accessibility

swiftui

ios

Making custom SwiftUI controls accessible with accessibilityRepresentation

Learn how to give a custom control the accessibility behavior of a native SwiftUI control.

19 Oct 2026 · 5 min read

Latest articles and tips

© 2026 tanaschita.com

Privacy policy

Impressum