Skip to content

Instantly share code, notes, and snippets.

@firedev
Created April 29, 2015 04:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save firedev/94f3cd8f5e7af2019e0f to your computer and use it in GitHub Desktop.
Save firedev/94f3cd8f5e7af2019e0f to your computer and use it in GitHub Desktop.
Ruby functional-style palette maker
require 'paleta'
colors = %w( 669900 66FF00 66CCFF 6699FF 6633FF )
to_color = ->(color) { Paleta::Color.new(:hex, color) }
to_div = ->(color) { "<div style='width: 3em; height: 3em; background: ##{color}; float: left'></div>" }
puts colors.uniq.map(& to_color).sort_by(&:hue).map(&:hex).map(& to_div)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment