diff --git a/.gitignore b/.gitignore index 330d167..50cc071 100644 --- a/.gitignore +++ b/.gitignore @@ -88,3 +88,7 @@ fastlane/test_output # https://github.com/johnno1962/injectionforxcode iOSInjectionProject/ + +# IntelliJ +.idea +*.iml \ No newline at end of file diff --git a/README.md b/README.md index f8162f6..5ee0770 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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. diff --git a/prompts/understand_project.md.jinja2 b/prompts/understand_project.md.jinja2 new file mode 100644 index 0000000..e0a43f1 --- /dev/null +++ b/prompts/understand_project.md.jinja2 @@ -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 \ No newline at end of file