@studiocms/ui
Version:
The UI library for StudioCMS. Includes the layouts & components we use to build StudioCMS.
26 lines (25 loc) • 610 B
JavaScript
class DevToolbarColorPicker extends HTMLElement {
input;
constructor() {
super();
const shadowRoot = this.attachShadow({ mode: "open" });
shadowRoot.innerHTML = `<input type="color" />`;
this.input = shadowRoot.firstElementChild;
this.input.addEventListener("input", () => {
this.dataset.color = this.input.value;
});
}
connectedCallback() {
this.input.value = this.dataset.color;
}
getColor() {
return this.input.value;
}
setColor(color) {
this.dataset.color = color;
this.input.value = color;
}
}
export {
DevToolbarColorPicker as default
};