I am doing color palettes and it needs to have a predefined palette and then choose the colors from it the thing is it must be mutable and for this I have come with this solution
<div class='colorScope'>
<div id="colorBackgroundDark<%=project.id%>">
<div id="Dark1<%=project.id%>">
</div>
<div id="Dark2<%=project.id%>">
</div>
</div>
<div id="colorBackgroundLight<%=project.id%>">
<div id="Light1<%=project.id%>">
</div>
<div id="Light2<%=project.id%>">
</div>
</div>
</div>
Project Id is given by rails, when a project with palettes is created (this is the html for the idea)
And here is the Js that should make the mutable palettes and is not working for some reason I am not able to figure out, I really hope you guys can please help me, please take in account again I am a rookie and be kind with me :x
function colorPalettes(id){
var myElement = document.getElementById('colorBackgroundDark'+id);
myElement.style.backgroundColor = "#D93600";
myElement.style.width = "50%";
myElement.style.height = "256px";
var myElement3 = document.getElementById('Dark1'+id);
myElement3.style.backgroundColor = "#D93600";
myElement3.style.width = "50%";
myElement3.style.height = "256px";
var myElement4 = document.getElementById('Dark2'+id);
myElement4.style.backgroundColor = "#D93600";
myElement4.style.width = "50%";
myElement4.style.height = "256px";
var myElement2 = document.getElementById('colorBackgroundLight'+id);
myElement2.style.backgroundColor = "#ffffff";
myElement2.style.width = "50%";
myElement2.style.height = "256px";
var myElement5 = document.getElementById('Light1'+id);
myElement5.style.backgroundColor = "#00474E";
myElement5.style.width = "50%";
myElement5.style.height = "256px";
var myElement6 = document.getElementById('Light2'+id);
myElement6.style.backgroundColor = "#6CEEFC";
myElement5.style.width = "50%";
myElement5.style.height = "256px";
}
$( document ).ready(function() {
var id = $('[type="range"]').attr('id')
colorPalettes(id);
});