https://github.com/layervault/ase.rb
Reader/writer for Adobe Swatch Exchange files in Ruby
https://github.com/layervault/ase.rb
Last synced: 4 months ago
JSON representation
Reader/writer for Adobe Swatch Exchange files in Ruby
- Host: GitHub
- URL: https://github.com/layervault/ase.rb
- Owner: layervault
- License: mit
- Created: 2013-07-24T00:18:41.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2014-02-28T19:02:51.000Z (about 12 years ago)
- Last Synced: 2024-11-22T07:36:58.705Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 277 KB
- Stars: 48
- Watchers: 5
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ASE.rb
A general purpose library for reading and writing Adobe Swatch Exchange files in Ruby. ASE files can be used across the entire Adobe Creative Suite (Photoshop, Illustrator, etc).
## Installation
Add this line to your application's Gemfile:
gem 'ase'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ase
## Usage
**Writing**
``` ruby
doc = ASE.new
palette = ASE::Palette.new('My Colors')
palette.add 'Black', ASE::Color::RGB.new(0, 0, 0)
palette.add 'Red', ASE::Color::RGB.from_hex('#ff0000')
palette.add 'Blue', ASE::Color::CMYK.new(0.92, 0.68, 0.2, 0)
palette.add 'Light Gray', ASE::Color::Gray.new(0.75)
doc << palette
doc.to_file('path/to/file.ase')
```
**Reading**
``` ruby
doc = ASE.from_file('path/to/file.ase')
puts doc['My Colors']['Red'].to_a
#=> [255, 0, 0]
puts doc['My Colors'].size
#=> 2
```
## Notes
* If the ASE file does not define a palette, and instead simply lists colors, ASE.rb will use `:default` as the palette name.
* ASE.rb does not support LAB colors yet.
* Because reading & writing CMYK/LAB colors is dependent on your color profile, the output might be different than what is shown in an Adobe application. Color profile support might be added in the future.
* Gray and Grey are interchangeable in ASE.rb
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request