Skip to content

Menu

Duotone Generator

Generate CSS duotone color effects

Runs entirely in your browserDesignFree, no sign-up
Loading tool

01What is Duotone Generator?

A duotone recolors a photo with just two colors. Dark areas take your shadow color and light areas take your highlight color, with smooth blends in between. Designers usually do this in an image editor, one file at a time. This generator gives you code instead, so the browser applies the effect to any image you point it at. The main output is an SVG filter built on feColorMatrix, the matrix primitive defined in the W3C Filter Effects spec. For each color channel, the tool writes one matrix row that works out shadow + (highlight - shadow) x luminance. Luminance uses the Rec. 709 weights 0.2126, 0.7152 and 0.0722. Because of that, pure black lands exactly on your shadow color and pure white lands exactly on your highlight. You do not need a grayscale step first. The filter also sets color-interpolation-filters="sRGB". Without it, browsers do filter math in linearRGB by default and your colors would come out shifted. Take the Navy & Gold preset, #1a237e and #ffd700. The red row comes out as 0.1909 0.6423 0.0648 0 0.102. The last number is the shadow's red, 26 out of 255. The first three are the luma weights scaled by how far red travels from shadow to highlight. In the blue row the weights turn negative, because gold has less blue than navy. You get two more snippets. One applies the filter with filter: url(#your-id). The other is a CSS-only take using grayscale, mix-blend-mode: multiply on the image and a lighten overlay in the shadow color. Hex input accepts six or three digits. Anything else, including named colors like red, is read as black. The Filter ID field swaps unsafe characters for hyphens and adds an f before a leading digit or hyphen, so the ID stays valid in both id="" and url(#...). Controls include color pickers, hex fields, six presets and a Random button. The Preview runs your actual filter over a grayscale test pattern next to the original, plus a five-step tone ramp. A few honest limits. The blend-mode version is an approximation, since lighten works channel by channel, so mid-tones can drift from the SVG result. The tool does not export image files. The matrix and snippets are computed in your tab from the two colors you pick, and no image is ever uploaded.

Front-end developers and web designers who want a branded two-color photo treatment applied in CSS instead of re-exporting every image. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Duotone Generator

  1. Set the Shadow Color and Highlight Color with the color pickers or the hex fields
  2. Optionally click a preset or the Random button to try other pairs
  3. Change the Filter ID if you need more than one duotone on the page
  4. Compare the original test pattern with the filtered one in the Preview section
  5. Copy the SVG Filter Code into your HTML and the Apply SVG Filter via CSS rule into your stylesheet, or copy the CSS Mix-Blend-Mode Approach instead

03Worked examples

Input: Shadow #003366, highlight #ff9900 (the defaults)
Result: values="0.2126 0.7152 0.0722 0 0 0.085 0.2861 0.0289 0 0.2 -0.085 -0.2861 -0.0289 0 0.4 0 0 0 1 0"
Only the feColorMatrix values are shown. The blue row is negative because the highlight has less blue than the shadow.
Input: Navy & Gold preset: shadow #1a237e, highlight #ffd700
Result: 0.1909 0.6423 0.0648 0 0.102 0.1501 0.5048 0.051 0 0.1373 -0.105 -0.3534 -0.0357 0 0.4941
The three color rows of the matrix. The last number in each row is the shadow channel divided by 255.
Input: Shadow #ff00ff, highlight #00ffff
Result: -0.2126 -0.7152 -0.0722 0 1 0.2126 0.7152 0.0722 0 0 0 0 0 0 1
Blue is 255 in both colors, so the blue row is a constant 1. Rows computed with the same formula the component uses.
Input: Shadow typed as red, highlight #fff
Result: Every color row = 0.2126 0.7152 0.0722 0 0
Named colors are not parsed and fall back to black, so this becomes a plain grayscale filter.
Input: Filter ID typed as 2024-team, then as hero photo
Result: f2024-team hero-photo
An f is added before a leading digit or hyphen, and spaces or other unsafe characters become hyphens.

04Common use cases

  • Giving a mixed set of team headshots one consistent brand treatment on an About page
  • Recoloring hero images to match a campaign palette without exporting new files from an editor
  • Building a hover effect that switches a thumbnail from duotone back to full color by removing the filter
  • Making cheap stock photos of different quality look like one set in a blog listing
  • Running two different duotones on one page by giving each filter its own Filter ID
  • Checking how a brand color pair holds up across the full tone range using the ramp in the preview

05Tips

  • Keep the color-interpolation-filters="sRGB" attribute if you edit the filter. Remove it and the browser computes in linearRGB, which shifts every tone.
  • Swap the shadow and highlight to get an inverted, negative-style look. The matrix handles it with negative weights, no extra step needed.
  • Paste the hidden SVG once near the top of the body. Every element that uses url(#id) can share it.
  • Type colors as hex only. A named color such as red is read as black, so the result will look wrong.
  • Pairs with a big lightness gap keep faces and text readable. Two mid-tones flatten the image.

06Related concepts

feColorMatrix, SVG filters, Rec. 709 luma, color-interpolation-filters, mix-blend-mode.

Frequently Asked Questions

What is Duotone Generator?

Duotone Generator is a free, browser-based developer tool on AIDToolStack. Generate CSS duotone color effects It requires no installation or sign-up and works entirely in your browser.

Is Duotone Generator free to use?

Yes. No sign-up, no fees and no usage cap.

Does Duotone Generator store my data?

No. It runs in your browser; nothing is uploaded.

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe