Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ColorKit

Swift Platforms SPM License

한국어

JSON design tokens to Swift colors. Zero configuration required. with Claude Code

Features

  • Auto-discovers colors from JSON files
  • Light/Dark mode with automatic switching
  • Multiple access patterns (property, subscript, namespace)
  • Fallback system for missing colors
  • SwiftUI and UIKit support
  • Figma token compatible

Installation

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/ParkSY0919/ColorKit.git", from: "0.2.0")
]

Xcode

  1. File → Add Package Dependencies
  2. Enter https://github.com/ParkSY0919/ColorKit.git
  3. Assign both ColorKit and ColorKitPlugin to your target

Quick Start

1. Add JSON file to your project

Create colors.json and add it to your Xcode project:

  • Drag the file into Xcode
  • Check "Copy items if needed"
  • Check your app target in "Add to targets"
{
  "brand-primary": "#007AFF",
  "background-main": "#FFFFFF",
  "text-heading": "#1D1D1F"
}

2. Configure at app launch

Pass the file name (without .json extension) to configure():

import ColorKit

@main
struct MyApp: App {
    init() {
        ColorKit.configure(jsonFileName: "colors")  // loads colors.json
    }

    var body: some Scene {
        WindowGroup { ContentView() }
    }
}

3. Use colors

Text("Hello")
    .foregroundColor(Colors.textHeading.color)
    .background(Colors.backgroundMain.color)

Dark Mode

Create separate files with -light and -dark suffixes:

colors-light.json
colors-dark.json

Colors switch automatically based on system appearance.

Access Patterns

// Property access (recommended)
Colors.brandPrimary.color

// Subscript for exact keys
Colors["brand-primary"]?.color ?? .blue

// Namespace access
Colors.Brand.primary.color
Colors.Background.main.color

Documentation

Requirements

  • iOS 14.0+ / macOS 11.0+
  • Swift 5.9+
  • Xcode 15.0+

License

MIT License. See LICENSE for details.

About

🎨 for iOS Library (Support for other platforms is planned for the future)

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages