Expand description

Implements a wrapper type for NSColor and UIColor. It attempts to map to a common shared API, but it’s important to note that the platforms themselves have differing levels of support for color work. Where possible, we expose some platform-specific methods for creating and working with these.

We attempt to provide fallbacks for older versions of macOS/iOS, but this is not exhaustive,

Structs

A Style is passed to you when doing dynamic color calculations. You can opt to provide different colors depending on the settings in here - notably, this is useful for supporting dark mode and high contrast accessibility contexts.

Enums

Represents a Color. You can create custom colors using the various initializers, or opt to use a system-provided color. The system provided colors will automatically switch to the “correct” colors/shades depending on whether the user is in light or dark mode; to support this with custom colors, you can create a dynamic color with a custom handler that determines a color depending on a variety of system settings.

Represents the contrast level for a rendering context.

Represents a rendering style - dark mode or light mode. In the event that a new variant is introduced in later versions of macOS or iOS, calls that use the dynamic color(s) from here will likely default to the Light theme.