Skip to content

lilingxi01/radix-colors-swift

Repository files navigation

Radix Colors for SwiftUI

Radix Colors is a great color palette for software design and development. But its library is originally implemented in TypeScript, which takes a lot of effort to use in other languages including SwiftUI.

This library is intended to provide a simple way to use Radix Colors in SwiftUI. It parses the original library and generates a Swift file that contains all the colors. Alongside all colors, it also provides a set of extension variables for SwiftUI built-in Color module, which supports dynamic color (a mix of both light color and dark color for light mode and dark mode respectively).

Usage

The file RadixColors.swift (located in output folder) is generated by parsing the original library. It contains all the colors in Radix Colors.

To use Radix Colors in your SwiftUI project, simply copy the RadixColors.swift file into your project. The reason why we do not want to make it a Swift Package is that we want to avoid any redundant import statement in your code. We want you to be able to use it directly and globally, and can change some helper functions as you wish.

Reference