Skip to content

Instantly share code, notes, and snippets.

@krzysu
Created July 26, 2012 14:27
Show Gist options
  • Save krzysu/3182365 to your computer and use it in GitHub Desktop.
Save krzysu/3182365 to your computer and use it in GitHub Desktop.
color palete generator
class ColorPalete
constructor: ->
@colors =
'blue': [
'0D2861'
'133783'
'3A5897'
'6179AC'
'96A3C3'
'A7B1CD'
'B3BACC'
'BCC6D7'
'C3CCDF'
'D2D9E7'
'E4E6EA'
'ECEEF3'
'F0F2F7'
]
'grey': [
'323232'
'565656'
'7F7F7F'
'CBCBCB'
'F0F0F0'
]
'pink': [
'9E005D'
'D31359'
'EC1D78'
]
generate: (el = '#color-palete') ->
$box = $(el)
if $box.length > 0
$result = $()
$.each @colors, (key, values) ->
$header = $('<h4 />').text key
$result = $result.add $header
$.each values, (index, item) ->
$color = $('<div />')
.css
'background-color': '#' + item
'min-height': '50px'
.text '#' + item
$result = $result.add $color
$box.append $result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment