Skip to content

Commit 6f7bedc

Browse files
authored
Change the jscolor format to HEX instead of HEXA (#148)
* Change the jscolor format to HEX instead of HEXA * Remove the alpha value from HEXA when its FF
1 parent 1b7cbee commit 6f7bedc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/demo/js/script.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,17 @@ let preview = {
7171
label.innerText = property;
7272
label.setAttribute("data-property", property);
7373
// color picker
74+
const jscolorConfig = {
75+
format: 'hexa',
76+
onChange: 'pickerChange(this, "'+property+'")',
77+
onInput: 'pickerChange(this, "'+property+'")'
78+
};
7479
const input = document.createElement("input");
7580
input.className = "param jscolor";
7681
input.id = property;
7782
input.name = property;
7883
input.setAttribute("data-property", property);
79-
input.setAttribute("data-jscolor", "{ format: 'hexa', onInput: 'pickerChange(this, \"" + property + "\")' }");
84+
input.setAttribute("data-jscolor", JSON.stringify(jscolorConfig));
8085
input.value = value;
8186
// removal button
8287
const minus = document.createElement("button");

0 commit comments

Comments
 (0)