import "https://esm.sh/vanilla-colorful@0.7.2";
function render({ model, el }) {
// Create the container for the color picker
let container = document.createElement("div");
container.style.position = "relative"; // Ensure container has a relative position
container.style.width = "300px"; // Set a fixed width for the color picker
container.style.height = "300px"; // Set a fixed height for the color picker
el.appendChild(container);
// Create the input element for the color picker
let colorPicker = document.createElement("hex-color-picker");
colorPicker.color = "#1e88e5"; // Set the initial color
container.appendChild(colorPicker);
// Add an event listener for color changes
colorPicker.addEventListener("color-changed", (event) => {
// get updated color value
const newColor = event.detail.value;
console.log(newColor); // You can use this color value as needed
});
// get current color value
console.log(colorPicker.color);
}
export default { render };