<button onclick="getColor()">カラーピッカーを起動する</button>
<p id="Color"/>
if (window.EyeDropper == undefined) {
console.error('EyeDropper API is not supported on this platform');
Color='EyeDropper API is not supported on this platform'
}
const eyeDropper = new EyeDropper();
async function getColor(){
const color=await eyeDropper.open()
console.log(color)
Color.innerText=color.sRGBHex
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.