mdbassit / Coloris

A lightweight and elegant JavaScript color picker. Written in vanilla ES6, no dependencies. Accessible.
https://coloris.js.org/examples.html
MIT License
461 stars 58 forks source link

Display Value color after refresh page #97

Closed amonam closed 1 year ago

amonam commented 1 year ago

I have a default color value of "#202124" and I use JavaScript to programmatically change it to "#ff0000" when the page refreshes. However, when I check the HTML in the console, it shows that the selected color has been changed, but it does not reflect on the screen.

darkmode

Here are the code snippets: The input element has a class "bg_color_input_Class" and a default value of "#202124".

I use the JavaScript code below to change the value to "#ff0000": var inputElementBgColorDark = document.getElementById("background_color_dark"); inputElementBgColorDark.setAttribute("value", "#ff0000");

Could you give me a little clue on how to fix it?

mdbassit commented 1 year ago

The solution is in the "Manually updating the thumbnail" section of the README. https://github.com/mdbassit/Coloris#manually-updating-the-thumbnail