Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,7 @@ fastlane/test_output
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

# IntelliJ
.idea
*.iml
80 changes: 60 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
# ColorPaletteGenerator
# ColorGen

`ColorPaletteGenerator` is a tool that takes a human-readable input file describing a color palette, and generates the associated code / assets that an Xcode project can use.
## Introduction

This is the successor to the `RMRColorTools` project that was written in Objective-C and has some legacy aspects to it that just aren't necessary. It is intended to be used in exactly the same way, but be available via the Swift Package Manager.
`ColorGen` is a command-line tool designed to generate color assets and code from a human-readable text file. This tool is particularly useful for designers and developers working on Xcode projects, as it simplifies the process of managing color palettes. The project is a successor to the `RMRColorTools` project, rewritten in Swift for better integration with the Swift Package Manager.

In the input file, you can declare:
### Key Features
- Define colors in hex format, including support for dark mode.
- Create aliases for colors to promote reuse and consistency.
- Generate .xcassets catalogs and Swift code for easy integration into Xcode projects.

- A hex color value and provide it a label
- 2 hex color values for one label, if you need different colors for 'dark mode' on iOS
- Aliases to previously declared colors, so you can define a color and give it an abstract name, but use an alias for a specific purpose (i.e. navigationBarTitle)
- "Private" colors, who can be used to generate aliases. For example, you name them abstract names, but create aliases that are functional (i.e. label, cellTitle, etc.). It can ensure that developers aren't randomly picking colors for the interface, but are using colors named for specific purposes.
## Usage Example

The Input File will ultimately generate:
Create a file named `MyAppColors.palette` with the following content:

- An .xcassets Assets Catalog with the colors (so to be available to Interface Builder)
- A namespaced struct that contains all the color definitions as Constants that will reference these Colors in the asset catalog.
- You can specify whether this namespaced struct has a public ACL or is internal (default).


## Input File Format

```
```plaintext
// MyAppColors.palette
//
// Lines beginning with // are ignored by the parser, so you can add comments for your team members.
//
// Or you can make comments be generated into the output file by adding them after the color name (see below)


// Define an opaque color in RRGGBB Hex Format. e.g. #FFEE24. (# character is required!)
#RRGGBB ColorName Add some comments that should be generated into the output file.

Expand All @@ -45,6 +37,54 @@ $ColorName MainTitleText
$_almostBlack SecondaryTextColor But private colors can be used to generate 'functional' color names without exposing the abstract name to (say) a developer

// You should ideally define your colors at the top, and all aliases below them!
```

Run the following command to generate the color assets and Swift code:

```sh
colorgen MyAppColors.palette
```

## Installation

To install `ColorGen`, you can use the Swift Package Manager or download a pre-built binary.

### Swift Package Manager

Add the following dependency to your `Package.swift` file:

```swift
dependencies: [
.package(url: "https://github.com/mlamina/ColorGen", from: "1.0.0")
]
```

### Pre-built Binary

Download the pre-built binary from the [releases page](https://github.com/mlamina/ColorGen/releases) and place it in your desired location.

## Building and Testing

### Building

To build the project, run the following command:

```sh
swift build
```

To create a universal binary for both Intel and M1 Macs, run the `build_fat_binary.sh` script:

```sh
./build_fat_binary.sh
```

### Testing

To run the tests, use the following command:

```sh
swift test
```

``

This will execute the unit tests and ensure that the tool is working as expected.
13 changes: 13 additions & 0 deletions prompts/understand_project.md.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
We need to understand and describe this project better.

Read these files:
- README.md
- Knowledgebase.txt
- Package.swift
- build_fat_binary.sh

Then update README.md so that it matches the following criteria:
- An intro section explaining the purpose and value of the project
- A usage example
- A section on how to install the project
- A section on how to build and test the project