Swiftpack.co - jjotaum/Chroma as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by jjotaum.
jjotaum/Chroma 0.5.0
A command line tool to auto generate .swift extensions or structs files from .xcassets on your iOS, macOS & SwiftUI projects.
⭐️ 4
🕓 4 weeks ago
macOS
.package(url: "https://github.com/jjotaum/Chroma.git", from: "0.5.0")

Chroma

A command line tool to auto generate .swift extensions or structs files from .xcassets on your iOS, macOS & SwiftUI projects.

Usage

$ Chroma --help

USAGE: chroma --asset <asset> --path <path> [--type <type>] [--platform <platform>]

OPTIONS:
  -a, --asset <asset>     The path of .xcasset file. 
  -p, --path <path>       The path of the generated .swift file. 
  -t, --type <type>       Specifies generated file type.
                          Supported values: "extension","struct". (default:
                          extension)
  --platform <platform>   Specifies the platform compatibility of the exported
                          file.
                          iOS, macOS, swiftUI (default: iOS)
  -h, --help              Show help information.

Installation

Clone Chroma on your machine:

$ git clone https://github.com/jjotaum/Chroma.git

Navigate to it's directory:

$ cd Chroma

Execute install script

$ ./install.sh

Chroma should now be installed on /usr/local/bin and can be accessed via terminal.

$ chroma

Integrate Chroma on your Xcode Project

You can easily integrate Chroma on your Xcode project to maintain your generated files updated.

Select your project target on Xcode > go to Build Phases tab > Press on + > Select New Run Script Phase.

Copy & paste below command on your new script phase and update paths & platform parameters according to your needs.

chroma --asset MyProject/Assets.xcassets --path MyProject/Extensions/Colors.swift --platform swiftUI

Optionally you can rename your new Run Script to Chroma.

GitHub

link
Stars: 4
Last commit: 4 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

0.5.0
4 weeks ago

What's Changed

  • Add LICENSE

  • Update README file to include steps to integrate Chroma on Xcode

  • Add .clear default value for iOS and macOS generated colors instead of using ! force unwrap approach

  • Improve unit tests

  • Add suport to auto generate and group colors by MARKS based on .xcassets folder structure

  • Refactor structure of some classes and methods, add comments to methods to make them easier to understand

  • Release 0.5.0 by @jjotaum in https://github.com/jjotaum/Chroma/pull/15

Full Changelog: https://github.com/jjotaum/Chroma/compare/0.4...0.5.0

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics