This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
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.
open() open(options)
options OptionalAn options object to pass an AbortSignal signal:
signal OptionalAn AbortSignal. The eyedropper mode will be aborted when the AbortSignal's abort() method is called.
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:
sRGBHexA string representing the selected color, in hexadecimal sRGB format (#aabbcc).
Exceptions are not thrown but returned when the Promise is rejected.
NotAllowedError DOMException
Thrown if open() is not called via a transient user activation.
InvalidStateError DOMException
Thrown if another eye dropper has already opened.
AbortError DOMException
Thrown if the user aborts the selection by pressing the Esc key or if the selection is aborted by an AbortController being passed as an argument to open().
OperationError DOMException
Thrown if the selection fails for other reasons.
| Specification |
|---|
| EyeDropper API> # dom-eyedropper-open> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
open |
95 | 95 | No | 81 | No | No | No | No | No | No | No | No |
EyeDropper interface it belongs to.
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper/open