Contents

diniska/swiftui-system-colors

Use standard **system colors** from **SwiftUI** on iOS, macOS or tvOS.

How to use

Step 1

Add a dependency using Swift Package Manager to your project: https://github.com/diniska/swiftui-system-colors

Step 2

Import the dependency

import SystemColors

Step 3

Use system colors from SwiftUI the same way you do with UIColor or NSColor:

Rectangle()
	.background(Color.label)

Contribution

Please, open a pull request or an issue if you find that one or the other color is missing or represented in a wrong way.

Please, only add system colors to this package. We only provide convenient interfaces without making a decision about how some colors should look. For example, if there is no color systemFill provided by macOS - we don't provide it on macOS either, but for iOS, it exists and we provide that color on iOS.

If you have ideas of how to better test the provided bridging code - please add an issue with the description of your idea or add a pull request with the implementation.

Please, keep the similar code style if you propose a change to the package. Current code style has the next benefits:

  • Easy to edit with multiple cursors
  • Easy to add new colors with documentation by copying the documentation from Xcode and using multiple cursors
  • Providing relevant links to the parts of the standard documentation.

Package Metadata

Repository: diniska/swiftui-system-colors

Default branch: master

README: README.md