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).
Add this line to your application's Gemfile:
gem 'ase'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ase
Writing
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
doc = ASE.from_file('path/to/file.ase')
puts doc['My Colors']['Red'].to_a
#=> [255, 0, 0]
puts doc['My Colors'].size
#=> 2
- 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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request