Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/giginet/color-tool
Small tool to generate .clr and .swift color constant files
https://github.com/giginet/color-tool
Last synced: 1 day ago
JSON representation
Small tool to generate .clr and .swift color constant files
- Host: GitHub
- URL: https://github.com/giginet/color-tool
- Owner: giginet
- License: other
- Created: 2016-03-17T01:35:07.000Z (almost 9 years ago)
- Default Branch: develop
- Last Pushed: 2015-05-01T11:47:23.000Z (over 9 years ago)
- Last Synced: 2025-01-19T16:49:52.960Z (5 days ago)
- Language: Swift
- Size: 258 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE.md
Awesome Lists containing this project
README
# color-tool
A simple tool to generate color constants
## Usage
Copy `color-tool` someplace where you can access it, e.g. into your `/usr/local/bin` folder.
### Input formats
Currently only a simple text based format is supported. An input files looks something like this:
# Section header
00AAFF: My Beautiful Color
332211: Another One
123456: And yet another oneSections start with an optional name and the entries just after it. Use blank lines to separate sections.
An entry starts with a 6-digit hex value describing the RGB value, followed by a colon and the color name.
Whitespaces are trimmed at the start, end and after the colon.The default file ending for those files is `.scl` (simple color list).
### Generating Apple Color Palette files (.clr)
`color-tool create-clr /path/to/input.scl /path/to/output.clr`
Creates an Apple Color Palette file. This file can be opened from the color picker which then
provides the colors as a palette.The output path is optional. If the path is omitted or a directory the input file name is taken and
the file extension is changed to `.clr`.### Generating Code Constants
`color-tool create-constants --format=format --prefix=prefix /path/to/input.scl /path/to/output-file`
Generates code constants from the colors.
The output path is optional. If the path is omitted or a directory the input file name is taken and
the file extension is changed according to the specified format.Valid Options:
* --format: `swift`, `scss` or `android`. If the format parameter is omitted, `swift` is assumed.
* --prefix (optional): An optional prefix which gets added first before the name. Example: $prefix- for `scss`, prefix_ for `android`. Swift does not need it since it's already scoped in a StructSample swift constants:
// GENERATED FILE - DO NOT MODIFY
struct Sample {
static let myBeautifulColor = UIColor(red: 0.0, green: 0.67, blue: 1.0, alpha: 1.0)
static let anotherOne = UIColor(red: 0.2, green: 0.13, blue: 0.07, alpha: 1.0)
static let andYetAnotherOne = UIColor(red: 0.07, green: 0.2, blue: 0.34, alpha: 1.0)
}Sample SCSS constants:
// GENERATED FILE - DO NOT MODIFY
$my-beautiful-color: #00AAFF;
$another-one: #332211;
$and-yet-another-one: #123456;
Sample Android colors.xml:
#00AAFF
#332211
#123456
### Generating a PDF Color Guide
`color-tool create-guide /path/to/input.scl /path/to/output.pdf`
Generates a pdf file containing the colors with the names, hex and RGB values.
The output path is optional. If the path is omitted or a directory the input file name is taken and
the file extension is changed to `.pdf`.