Skip to content

Rails Plugin which finds interesting CSS colors in an image, which can be used to suggest custom theme colors based on an uploaded image.

License

Notifications You must be signed in to change notification settings

Fudge/colors_from_image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ColorsFromImage
===============

Find colors from an example image, which can be used to provide theme colors
matching an uploaded logo. 

Inspired by http://blog.dabbledb.com/2007/04/white--or-green.html

It uses RMagick / ImageMagick to find interesting colors from an image
based on saturation, luminance, and the histogram.

Installation
============

Rails 2.1:

./script/plugin install git://github.com/Fudge/colors_from_image.git

Rails 2.0.2:

cd vendor/plugins; git clone git://github.com/Fudge/colors_from_image.git

Example
=======

ColorsFromImage.get_colors('/path/to/logo.jpg') # => ["#020202", "#fb680d", "#dc8e53", "#9f643f"]

background, primary, secondary, tertiary = ColorsFromImage.get_colors('/path/to/logo.jpg')
text_color = ColorsFromImage.dark?(background) ? "#fff" : "#333"


The first result is the background color (nil if the image is transparent), and the following entries
are the interesting colors sorted by relevance. 

Copyright (c) 2008 Erlend Simonsen, released under the MIT license

About

Rails Plugin which finds interesting CSS colors in an image, which can be used to suggest custom theme colors based on an uploaded image.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages