The EyeDropper.open()
method starts the eyedropper mode, returning a promise which is fulfilled once the user has selected a color and exited the eyedropper mode.
A Promise
that eventually resolves when the user selects a pixel color from the screen.
The promise resolves to an object with the following property:
sRGBHex
-
A string representing the selected color, in hexadecimal sRGB format (#aabbcc
).
Exceptions are not thrown but returned when the Promise
is rejected. The promise is rejected in two cases:
- When the user dismisses the eyedropper mode by pressing the Escape key.
- When the eyedropper mode is aborted by the
AbortController
passed as an argument to open()
.