1

Requirements:

  1. Must have support across all browsers
  2. Allows the user to select a pixel from within a window and alert the result in hexadecimal form.
  3. Must be a bookmarklet

This is what I have so far.

javascript:window.EyeDropper&&(new EyeDropper()).open().then(result => alert(result.sRGBHex));

The EyeDropper API is only supported on Chromium-based browsers so far. As such, I am looking for a polyfill meeting all these requirements.

Polar
  • 11
  • 1
  • 2
  • If you're looking for someone to point you to or suggest an existing Polyfill for you, that [might be off-topic here](https://stackoverflow.com/help/on-topic). I think that could be okay if most existing polyfills are very small and very similar, or if there are very few existing ones, but I'm not sure. – rainbow.gekota Oct 18 '22 at 21:44
  • There is a method you could use. In modern browsers, you can use a canvas to systematically take a screenshot of the page by putting a canvas across the whole thing (see https://stackoverflow.com/questions/5621907/how-to-screenshot-website-in-javascript-client-side-how-google-did-it-no-nee ) Then, you could take the mouse coordinates and react by checking the RGB values of the corresponding pixel on the canvas, and then use a regEx to change the RGB values into a hex string (very easy to do just google it) and alert it to the user. – Hermanboxcar Mar 19 '23 at 04:17

0 Answers0