Kuler is a fun little webapp that allows you to discover, explore, and share color themes. This is a Ruby library to access the Kuler service.
To use Kuler, you’ll need an API key, which you can obtain from Adobe at kuler.adobe.com/api
First, set up a new Kuler instance with your API key. Either provide it directly as paramater:
kuler = Kuler.new('your api key')
or set ENV['KULER_API_KEY']
and leave the parameter:
kuler = Kuler.new
To interact with the Kuler API, you can fetch a random color theme and inspect it like so:
theme = kuler.fetch_random_theme theme.hex_codes #=> [ "#ff0000", "#00ff00", "#0000ff", "#ffff00", "#ff00ff" ]
To refine the search, use the Kuler#fetch_themes method:
themes = kuler.fetch_themes(:type => :rating, :limit => 3) #=> [ #<Kuler::Theme ...>, #<Kuler::Theme ...>, #<Kuler::Theme ...> ]
Retrieve color themes from Kuler:
- most recent themes
-
kuler.fetch_themes(:type => :recent)
- most popular
-
kuler.fetch_themes(:type => :popular)
- highest rated
-
kuler.fetch_themes(:type => :rated)
- random
-
kuler.fetch_themes(:type => :random)
- limit the results
-
kuler.fetch_themes(:limit => 25)
- offset the results
-
kuler.fetch_themes(:offset => 3)
More details on limitations, return values etc. are available in the RDoc.
For users:
* nokogiri
For developers:
* hoe * hoe-doofus * hoe-git * mocha
-
gem install kuler
kuler is copyright © 2010 Ben Bleything, and distributed under the terms of the MIT license. See the LICENSE file for details.