Onion Lens is a browser extension that picks colors from any web page and captures screenshots, for Chrome and other Chromium browsers, Firefox and Safari.
Designers and front-end developers constantly need two small things from a web page: the exact value of a color, and a picture of part of the page. Onion Lens does both from one toolbar button. You can grab any pixel, convert it between 10 color formats, build and export palettes, and check contrast against WCAG. You can capture the visible area, the full page, a dragged region or a single element, then annotate, copy or save the image.
It is one Manifest V3 codebase in plain JavaScript. There is no build step, no dependencies, no tracking and no network requests. Everything you pick and save stays in your browser.
- On-page eyedropper: Pick any pixel with a zoomable loupe. Move one pixel at a time with the arrow keys and pick several colors in a row with Shift.
- Sample size: Pick a single pixel, or the average of a 3 by 3 or 5 by 5 area.
- 10 color formats: HEX, RGB, HSL, HSV, HWB, CMYK, LAB, LCH, OKLAB and OKLCH. Click any value to copy it.
- Any CSS color as input: Type names,
oklch(), color(display-p3 ...) and more. An opacity slider and the nearest CSS color name are shown.
- Harmonies: Complementary, analogous, triadic, split complementary, tetradic, tints, shades and tones.
- Gradient builder: Linear, radial or conic gradients with an angle control, the in-between steps, and copyable CSS.
- WCAG contrast checker: AA and AAA results for normal text, large text and UI elements.
- Contrast auto-fix: Finds the closest lightness that passes AA (4.5:1).
- Color vision simulation: Preview colors as seen with protanopia, deuteranopia, tritanopia and achromatopsia.
- Element inspector: Hover any element to see its text, background and border colors, its contrast ratio and its font.
- Page scan and find: List every color a page uses, sorted by frequency, then click one to outline every element that uses it.
- Four screenshot modes: Visible area, full page, a dragged area, or a single element, with an optional delay.
- Screenshot editor: Crop, rectangle, arrow, pen, highlighter, text, pixelate/redact and eyedropper tools, with undo and redo.
- Palette from an image: Extract 5 to 16 dominant colors from a screenshot, a pasted or dropped image, or any image on a page.
- History and palettes: The last 50 picked colors, a Favorites palette, and named palettes you can export as CSS variables, SCSS, Tailwind, JSON or a HEX list.
Onion Lens is loaded as an unpacked extension. Download the latest release from the GitHub releases page. Each release includes unpacked Chrome and Firefox builds as zip files, plus store-ready zips. You can also clone the repository and load the folder directly, since there is no build step.
- Unzip the Chrome build (or use the cloned folder).
- Open
chrome://extensions (or edge://extensions in Edge).
- Turn on Developer mode.
- Click Load unpacked and select the folder.
- Open
about:debugging#/runtime/this-firefox.
- Click Load Temporary Add-on... and select
manifest.json in the Firefox build folder.
A temporary add-on is removed when Firefox restarts.
Convert the extension into an Xcode project:
xcrun safari-web-extension-converter /path/to/Onion-Lens
Build the generated Xcode project, then enable the extension under Safari > Settings > Extensions.
From the repository root:
./pack.sh
This writes Chrome and Firefox zips, plus unpacked folders, to dist/. Both come from the same manifest.json; each drops the keys the other browser warns about.
Click the Onion Lens toolbar icon (or press Alt+Shift+X) to open the popup. The top of the popup shows the current color: a swatch, a text field that accepts any CSS color, a native color dialog, an opacity slider and the nearest color name. Below it are six tabs: Formats, Harmony, Contrast, Page, Saved and Shot.
- Click the eyedropper button in the popup, or press
Alt+Shift+C. You can also right-click the page and choose Pick color from page.
- Move over the page. A loupe shows the pixels under the cursor.
- Use the controls below, then click to pick.
| Input |
Action |
| Mouse wheel |
Zoom the loupe |
| Arrow keys |
Move one pixel |
| Shift + arrow keys |
Move 10 pixels |
Click or Enter |
Pick the color |
Shift+click or Shift+Enter |
Pick and keep picking |
Esc |
Exit the picker |
With Copy on pick on (the default), the picked color is copied in your chosen copy format. Every pick is added to your history.
Open the Formats tab to see the color in all 10 formats: HEX, RGB, HSL, HSV, HWB, CMYK, LAB, LCH, OKLAB and OKLCH. Click any value to copy it. To start from a known color, type any CSS color into the text field at the top, for example rebeccapurple, #0af, oklch(70% 0.1 200) or color(display-p3 1 0 0).
Click the star button to add the current color to your Favorites palette.
The Harmony tab shows complementary, analogous, triadic, split complementary and tetradic colors, plus tints, shades and tones. Click a swatch to use it.
The Gradient section uses the current color as the first stop. Choose a second color, a type (Linear, Radial or Conic) and an angle (0 to 360 degrees). The in-between steps are shown, and the copy button copies the CSS.
- Open the Contrast tab. The current color is the text color.
- Enter a background color, or pick one with the color dialog. Use the swap button to exchange text and background.
- Read the ratio and the AA and AAA badges for normal text, large text and UI elements.
- If the pair fails, click the fix button to find the closest lightness that passes AA at 4.5:1.
The Color vision simulation section shows how the color looks with protanopia, deuteranopia, tritanopia and achromatopsia.
Open the Page tab.
- Inspect lets you hover any element to see its text, background and border colors, its contrast ratio and its font. It is also in the right-click menu as Inspect element colors.
- Scan lists every color the page uses, sorted by how often it appears. Click a color to outline every element that uses it. Use Clear highlights to remove the outlines, or Save as palette to keep the page's colors.
Open the Shot tab and choose a mode:
| Mode |
What it captures |
| Visible |
What is on screen |
| Full page |
The whole page, scrolled and stitched together. Sticky headers appear only once |
| Select area |
A box you drag. The page scrolls when you drag to an edge |
| Element |
One element or container, even when it is taller than the screen |
In Element mode, hover to highlight an element, use the mouse wheel or the up and down arrow keys to move to its parent or child, and click or press Enter to capture. Press Esc to cancel any selection.
Before capturing, set:
- After capture: Edit (open the editor), Copy to clipboard or Save picture.
- Delay: None, 3, 5 or 10 seconds. Useful for hover menus.
- Format: PNG or JPEG, with a JPEG Quality from 10 to 100.
- Ask where to save: off by default. When off, pictures go to
Downloads/Onion Lens/. Turn it on to choose another folder.
All four modes are also in the right-click menu. Alt+Shift+S captures an area and Alt+Shift+F captures the full page.
The editor opens after a capture when After capture is set to Edit. Choose a tool, set the annotation color and stroke size (1 to 40), and draw.
| Key |
Tool or action |
C |
Crop |
R |
Rectangle |
A |
Arrow |
P |
Pen |
H |
Highlighter |
T |
Text (Enter to finish, Esc to cancel) |
B |
Pixelate / redact |
I |
Eyedropper |
Esc |
Cancel the current drag, or deselect the tool |
Ctrl+Z |
Undo |
Ctrl+Shift+Z |
Redo |
Ctrl+C |
Copy the image |
Ctrl+S |
Save |
The zoom menu offers Fit, 50%, 100% and 200%. Use Copy, Save PNG or JPEG to export. The side panel shows image details.
- In the editor, the Palette from image panel shows the dominant colors. Choose 5, 8, 12 or 16 colors and click Save palette. Click a color to use it as ink and copy it.
- Paste or drop any image into the editor, or use its open button to load a file.
- Right-click any image on a page and choose Extract palette from this image.
Open the Saved tab.
- History shows your last 50 picked colors. Click Clear to empty it.
- Palettes lists Favorites and your named palettes. Type a name and click Create to add one.
- Export a palette as CSS variables, SCSS, Tailwind, JSON or a HEX list. The export is copied to the clipboard.
| Keys |
Action |
Alt+Shift+X |
Open the popup |
Alt+Shift+C |
Pick a color |
Alt+Shift+S |
Screenshot an area |
Alt+Shift+F |
Screenshot the full page |
To change them, go to chrome://extensions/shortcuts in Chromium browsers. In Firefox, open the Add-ons page, click the gear icon and choose Manage Extension Shortcuts.
Click the gear button in the popup to open settings. Screenshot options live on the Shot tab. All settings are saved in local extension storage.
| Setting |
Options |
Default |
| Copy format |
Any of the 10 formats |
HEX |
| Picker sample |
1 by 1 px, 3 by 3 average, 5 by 5 average |
1 by 1 px |
| Theme |
Dark, Light, System |
Dark |
| Copy on pick |
On or off |
On |
| Uppercase HEX |
On or off |
Off |
| After capture |
Edit, Copy to clipboard, Save picture |
Edit |
| Delay |
None, 3 s, 5 s, 10 s |
None |
| Format |
PNG, JPEG |
PNG |
| Quality (JPEG) |
10 to 100 |
92 |
| Ask where to save |
On or off |
Off |
Onion Lens has a few parts:
- A background script handles capturing, injecting scripts into the page, stitching tiles, downloads, the right-click menu and shortcuts.
- The popup is the main interface.
- The picker and selection scripts are injected into the current tab only when you use them.
- The editor is a separate extension page. Screenshots are handed to it through a small IndexedDB store.
- A color library does parsing, conversions, harmonies, contrast, color vision simulation and palette extraction.
One codebase for every browser. The code uses browser when it exists and chrome otherwise. The manifest declares both a service worker (used by Chrome) and background scripts (used by Firefox), and each browser ignores the one it does not use.
Eyedropper. Instead of the EyeDropper API, which only exists in Chromium and closes the popup, Onion Lens takes a screenshot of the visible tab and reads pixels from it.
Full-page and element captures. The page is scrolled one screen at a time and each step is captured. Captures are throttled to about two per second, which is Chrome's limit. The tiles are stitched on an OffscreenCanvas, and your original scroll position is restored afterwards.
Privacy. Onion Lens collects nothing and makes no network requests. Colors, palettes and settings stay in local extension storage, and screenshots exist only on your device. It asks for no host permissions. The activeTab permission gives it access to the current tab only when you click the toolbar icon, press a shortcut or use the right-click menu. Its other permissions are scripting, storage, contextMenus, clipboardWrite and downloads.
- A Chromium browser with Manifest V3 support: Chrome, Edge, Brave, Opera or Vivaldi.
- Firefox 140 or newer on desktop, or Firefox for Android 142 or newer.
- Safari on macOS, with Xcode to build the converted project.
Problem: The toolbar icon shows ! and nothing happens. Browser pages such as chrome:// and about: pages, and extension stores, cannot be scripted by any extension. Switch to a normal web page.
Problem: The bottom of a full-page screenshot is cut off. The page is taller than the browser's canvas limit (about 16,000 px). The editor shows a note when this happens. Capture the rest with Select area or Element.
Problem: A full-page shot only captured the visible area. The page scrolls an inner container instead of the window. Use Element on the scrolling container instead.
Problem: Full-page captures are slow. Captures are throttled to about two per second to stay within the browser's limit, so long pages take a few seconds.
Problem: A hover menu disappears before the capture. Set a Delay of 3, 5 or 10 seconds on the Shot tab, then open the menu.
Problem: Saved pictures are not where I expected. By default they go to Downloads/Onion Lens/. Turn on Ask where to save to choose a folder each time.
Problem: The extension disappeared from Firefox. Temporary add-ons loaded from about:debugging are removed on restart. Load it again.
Onion Lens is released under the MIT License.
It bundles the Inter and JetBrains Mono fonts, both under the SIL Open Font License 1.1.