Skip to content

Instantly share code, notes, and snippets.

@martinhoeller
Last active April 8, 2024 08:45
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinhoeller/38509f37d42814526a9aecbb24928f46 to your computer and use it in GitHub Desktop.
Save martinhoeller/38509f37d42814526a9aecbb24928f46 to your computer and use it in GitHub Desktop.
NSColor Catalog Colors
import Cocoa
import Foundation
var colors: [NSColor] = [.labelColor, .secondaryLabelColor, .tertiaryLabelColor, .quaternaryLabelColor, .textColor, .placeholderTextColor, .selectedTextColor, .textBackgroundColor, .selectedTextBackgroundColor, .keyboardFocusIndicatorColor, .unemphasizedSelectedTextColor, .unemphasizedSelectedTextBackgroundColor, .linkColor, .separatorColor, .selectedContentBackgroundColor, .unemphasizedSelectedContentBackgroundColor, .selectedMenuItemTextColor, .gridColor, .headerTextColor, .controlAccentColor, .controlColor, .controlBackgroundColor, .controlTextColor, .disabledControlTextColor, .selectedControlColor, .selectedControlTextColor, .alternateSelectedControlTextColor, .windowBackgroundColor, .windowFrameTextColor, .underPageBackgroundColor, .findHighlightColor, .highlightColor, .shadowColor
]
for color in colors {
var red: CGFloat = 0
var green: CGFloat = 0
var blue: CGFloat = 0
var alpha: CGFloat = 0
if let converted = color.usingColorSpace(.deviceRGB) {
converted.getRed(&red, green: &green, blue: &blue, alpha: &alpha)
let redInt = Int(red * 255)
let greenInt = Int(green * 255)
let blueInt = Int(blue * 255)
let alphaInt = Int(alpha * 255)
print("\(color.colorNameComponent): \(redInt) / \(greenInt) / \(blueInt) / \(alphaInt)")
}
}

A list of all NSColor catalog colors (macOS Sonoma 14.4)

Color values are (Red / Green / Blue / Alpha)

Color Name Light Mode Dark Mode
labelColor 0 / 0 / 0 / 216 255 / 255 / 255 / 216
secondaryLabelColor 0 / 0 / 0 / 127 255 / 255 / 255 / 140
tertiaryLabelColor 0 / 0 / 0 / 66 255 / 255 / 255 / 63
quaternaryLabelColor 0 / 0 / 0 / 25 255 / 255 / 255 / 25
textColor 0 / 0 / 0 / 255 255 / 255 / 255 / 255
placeholderTextColor 0 / 0 / 0 / 63 255 / 255 / 255 / 63
selectedTextColor 0 / 0 / 0 / 255 255 / 255 / 255 / 255
textBackgroundColor 255 / 255 / 255 / 255 30 / 30 / 30 / 255
selectedTextBackgroundColor 179 / 215 / 255 / 255 63 / 99 / 139 / 255
keyboardFocusIndicatorColor 0 / 103 / 244 / 127 26 / 169 / 255 / 127
unemphasizedSelectedTextColor 0 / 0 / 0 / 255 255 / 255 / 255 / 255
unemphasizedSelectedTextBackgroundColor 220 / 220 / 220 / 255 70 / 70 / 70 / 255
linkColor 0 / 104 / 218 / 255 65 / 156 / 255 / 255
separatorColor 0 / 0 / 0 / 25 255 / 255 / 255 / 25
selectedContentBackgroundColor 0 / 100 / 225 / 255 0 / 89 / 209 / 255
unemphasizedSelectedContentBackgroundColor 220 / 220 / 220 / 255 70 / 70 / 70 / 255
selectedMenuItemTextColor 255 / 255 / 255 / 255 255 / 255 / 255 / 255
gridColor 230 / 230 / 230 / 255 26 / 26 / 26 / 255
headerTextColor 0 / 0 / 0 / 216 255 / 255 / 255 / 255
controlAccentColor 0 / 122 / 255 / 255 0 / 122 / 255 / 255
controlColor 255 / 255 / 255 / 255 255 / 255 / 255 / 63
controlBackgroundColor 255 / 255 / 255 / 255 30 / 30 / 30 / 255
controlTextColor 0 / 0 / 0 / 216 255 / 255 / 255 / 216
disabledControlTextColor 0 / 0 / 0 / 63 255 / 255 / 255 / 63
selectedControlColor 179 / 215 / 255 / 255 63 / 99 / 139 / 255
selectedControlTextColor 0 / 0 / 0 / 216 255 / 255 / 255 / 216
alternateSelectedControlTextColor 255 / 255 / 255 / 255 255 / 255 / 255 / 255
windowBackgroundColor 236 / 236 / 236 / 255 50 / 50 / 50 / 255
windowFrameTextColor 0 / 0 / 0 / 216 255 / 255 / 255 / 216
underPageBackgroundColor 150 / 150 / 150 / 229 40 / 40 / 40 / 255
findHighlightColor 255 / 255 / 0 / 255 255 / 255 / 0 / 255
highlightColor 255 / 255 / 255 / 255 180 / 180 / 180 / 255
shadowColor 0 / 0 / 0 / 255 0 / 0 / 0 / 255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment