macOS Selected Text Background
NSColor.selectedTextBackgroundColorComplete technical specification and developer reference for Selected Text Background in Apple's macOS design system. In light appearance, it resolves to HEX #B3D7FF; in dark appearance, it dynamically adapts to HEX #3F638B. Features wide-gamut Display P3 values, UIKit bridge (UIColor.selectedTextBackgroundColor), AppKit bridge (NSColor.selectedTextBackgroundColor), WCAG contrast audit, and Xcode drop-in initializers.
The background of selected text.
ColorNSColor.selectedTextBackgroundColorColor(red: 0.702, green: 0.843, blue: 1.000)Color(red: 0.702, green: 0.843, blue: 1.000, opacity: 1.00)Color(hue: 0.588, saturation: 0.298, brightness: 1.000, opacity: 1.00)Color(.displayP3, red: 0.729, green: 0.839, blue: 0.984, opacity: 1.00)Color(.sRGB, red: 0.702, green: 0.843, blue: 1.000, opacity: 1.00)Color(hex: "#B3D7FF")#colorLiteral(red: 0.702, green: 0.843, blue: 1.000, alpha: 1.00)Color(uiColor: UIColor(red: 0.702, green: 0.843, blue: 1.000, alpha: 1.00))Technical Color Specifications
Exact resolved HEX codes, sRGB 8-bit components, HSL, and normalized Swift floating-point decimals for Light and Dark modes.
| Color Metric / Space | Light Appearance | Dark Appearance | Swift Code Literal |
|---|---|---|---|
| HEX Code | #B3D7FF | #3F638B | Color(hex: "#B3D7FF") |
| sRGB (0–255) | rgb(179, 215, 255) | rgb(63, 99, 139) | (r: 0.702, g: 0.843, b: 1.000) |
| Display P3 (Wide Gamut) | P3 (0.729, 0.839, 0.984) | P3 (0.278, 0.384, 0.533) | Color(.displayP3, ...) |
| HSL / HSB | hsl(212, 100%, 85%) | hsl(212, 38%, 40%) | Color(hue:sat:bri:) |
| Platform Bridge | UIKit: UIColor.selectedTextBackgroundColor | AppKit: NSColor.selectedTextBackgroundColor | Color(uiColor:) / Color(nsColor:) |
Light Appearance
#B3D7FFrgb(179, 215, 255)hsl(212, 100%, 85%)(r: 0.702, g: 0.843, b: 1.000)Dark Appearance
#3F638Brgb(63, 99, 139)hsl(212, 38%, 40%)(r: 0.247, g: 0.388, b: 0.545)Drop-In Developer Snippets
Ready-to-paste code blocks for Xcode asset catalogs and Swift files.
Contents.json inside Assets.xcassets/Selected Text Background.colorset/{
"colors": [
{
"color": {
"color-space": "srgb",
"components": {
"red": "0.702",
"green": "0.843",
"blue": "1.000",
"alpha": "1.000"
}
},
"idiom": "universal"
},
{
"appearances": [
{
"appearance": "luminosity",
"value": "dark"
}
],
"color": {
"color-space": "srgb",
"components": {
"red": "0.247",
"green": "0.388",
"blue": "0.545",
"alpha": "1.000"
}
},
"idiom": "universal"
}
],
"info": {
"author": "xcode",
"version": 1
}
}Live UI Component Sandbox
Preview Color.selected text background inside standard Apple interface components.
●SwiftUI Notification
Just nowDemonstrates how Apple designers pair system background tints with dynamic Selected Text Background accents.
.foregroundStyle(NSColor.selectedTextBackgroundColor)
Platform Implementation Snippets
Ready-to-use Swift code for SwiftUI, UIKit, and AppKit applications.
// AppKit (macOS)
let button = NSButton()
button.contentTintColor = NSColor.selectedTextBackgroundColor
// Custom Layer Tint
let layer = CALayer()
layer.backgroundColor = NSColor.selectedTextBackgroundColor.cgColor
// Bridging AppKit into SwiftUI
let swiftUIColor = Color(nsColor: .selectedTextBackgroundColor)WCAG 2.1 Accessibility Contrast Audit
Contrast calculations of Selected Text Background against pure white and iOS OLED dark surfaces.
Recommended HIG Use Cases
- Table view and outline view cells
- Window title bar text and dialog headings
- Form field captions and status labels
Anti-Patterns to Avoid
- Full window background surfaces
- Thick border fills
Browse More macOS Colors
Quickly jump to other Apple system colors and semantic tokens.
Frequently Asked Questions
How do I use NSColor.selectedTextBackgroundColor in macOS AppKit apps?
In AppKit, assign NSColor.selectedTextBackgroundColor to NSView, NSTextField, or NSButton styling. In SwiftUI on macOS, bridge it using Color(nsColor: .selectedTextBackgroundColor).
What is the HEX code for macOS Selected Text Background in light and dark mode?
In light appearance, Selected Text Background resolves to #B3D7FF. In dark appearance, it automatically adapts to #3F638B.
How do I bridge NSColor.selectedTextBackgroundColor into SwiftUI?
In SwiftUI views on macOS, instantiate Color(nsColor: .selectedTextBackgroundColor) to access the native AppKit dynamic color token.
Does Selected Text Background adapt to Dark Mode and vibrancy in macOS?
Yes, NSColor.selectedTextBackgroundColor is an appearance-aware NSColor that updates automatically when switching between light and dark modes or across vibrant desktop materials.
Why use AppKit system colors instead of hardcoded hex values?
NSColor system tokens adapt automatically to user accent color preferences, Dark Mode, and accessibility contrast settings.