Created
March 24, 2023 02:57
-
-
Save schaoss/59f2f024fca53f8753c32d50d2716d60 to your computer and use it in GitHub Desktop.
eye-dropper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!window.__CUSTON_ED__) window.__CUSTON_ED__ = new EyeDropper() | |
window.__CUSTON_ED__.open() | |
.then(({ sRGBHex }) => { | |
console.log('%c ' + `%c ${sRGBHex}`, `background: ${sRGBHex}`, `background: unset`) | |
navigator?.clipboard?.writeText?.(sRGBHex) | |
}) | |
.catch(() => {}) | |
// bookmarklet: javascript:(function()%7Bwindow.__CUSTON_ED__%7C%7C(window.__CUSTON_ED__%3Dnew%20EyeDropper)%2Cwindow.__CUSTON_ED__.open().then((%7BsRGBHex%3Ac%7D)%3D%3E%7Bconsole.log(%60%25c%20%20%25c%20%24%7Bc%7D%60%2C%60background%3A%20%24%7Bc%7D%60%2C%22background%3A%20unset%22)%2Cnavigator%3F.clipboard%3F.writeText%3F.(c)%7D).catch(()%3D%3E%7B%7D)%3B%7D)()%3B |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment