Cant store rgba Values with local storage. Either that or I have made a mistake. Were dealing with a few things here.
In my Js file I have stored a color picker RGBA value as a string and stored it as seen below.
pickr.on('change', (color, source, instance) => {
const rgbaColor = color.toRGBA().toString();
console.log(rgbaColor)
localStorage.setItem("C1",rgbaColor);
})
Then I have a separate Js file with this function.
function colors(){
document.querySelector('teamOne').style.background = localStorage.getItem("C1");
}
And Im trying to change the background color of a div in my css file. (im using scss btw)
#teamOne {
width: 50%;
}
I know that the color picker is working but the rest of the code wont. If someone could help that would be great.
Thanks
Figured it out. Should be:
document.getElementById('teamOne').style.backgroundColor = localStorage.getItem('C1');