Issue #717
Try to use predefined system colors in Human Interface Guidelines for macOS
Here we use this color unemphasizedSelectedTextBackgroundColor
for button background
HStack(spacing: 1) {
makeUnderListButton(action: {}, icon: .plus)
makeUnderListButton(action: {}, icon: .minus)
}
.background(Color(NSColor.unemphasizedSelectedTextBackgroundColor))
.cornerRadius(4)
func makeUnderListButton(action: @escaping () -> Void, icon: AwesomeIcon) -> some View {
Button(action: action) {
Text(icon.rawValue)
.font(.awesome(style: .solid, size: 14))
}
.buttonStyle(HighlightButtonStyle(h: 8, v: 6, cornerRadius: 4))
}
Another thing is List, where we have selected and alternative background colors. We should also use dynamic system colors selectedContentBackgroundColor
and alternatingContentBackgroundColors
VStack {
ForEach(apps.enumerated().map({ $0 }), id: \.element) { index, app in
makeRow(app: app)
.onTapGesture {
self.selected = app
}
.background(
self.selected == app
? Color(NSColor.selectedContentBackgroundColor)
: Color(NSColor.alternatingContentBackgroundColors[index % 2])
)
}
}