Skip to content

Instantly share code, notes, and snippets.

@jeremiahjstanley
Created August 21, 2018 23:16
Show Gist options
  • Save jeremiahjstanley/b85f195a11d53e4e5bbacd90afa254e1 to your computer and use it in GitHub Desktop.
Save jeremiahjstanley/b85f195a11d53e4e5bbacd90afa254e1 to your computer and use it in GitHub Desktop.
SadCode
function appendPalette(palette, id) {
const project = $.find('.project').filter(project => {
if (project.id == palette.project_id) {
return project;
};
});
if (project) {
$('.palette-message').text('');
$(`<section class='palette' id='${palette.id || id.id}'>
<span>
<h4>${palette.palette_name}</h4>
</span>
<article class='small-swatch' style='background-color:${palette.color_1}' value='${palette.color_1}'></article>
<article class='small-swatch' style='background-color:${palette.color_2}' value='${palette.color_2}'></article>
<article class='small-swatch' style='background-color:${palette.color_3}' value='${palette.color_3}'></article>
<article class='small-swatch' style='background-color:${palette.color_4}' value='${palette.color_4}'></article>
<article class='small-swatch' style='background-color:${palette.color_5}' value='${palette.color_5}'></article>
<button class='delete-palette'>X</button>
</section>`).appendTo(project)
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment