Skip to content

Instantly share code, notes, and snippets.

@jp26jp
Created June 23, 2016 17:19
Show Gist options
  • Save jp26jp/a560720d8cd26ee5a8d3c6ed41376093 to your computer and use it in GitHub Desktop.
Save jp26jp/a560720d8cd26ee5a8d3c6ed41376093 to your computer and use it in GitHub Desktop.
var colors = {}
Cookie.set('main', '#333');
$('#main').spectrum({
color: Cookie.get('main'), // gets the value of the 'main' cookie and sets it as the initial color
change: function(color){
colors.main = color.toHexString(); // returns the selected color as a hex string and assigns it to a 'main' property of the colors object
Cookie.set('main', colors.main); // updates the value of the 'main' cookie
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment