Monotone an Image with CSS

You can always apply a filter to an element to make it monotone in the grayscale sense:

See the Pen Monotone-ing an Image by Chris Coyier (@chriscoyier) on CodePen.

If you put that in a container with a background color and lower the opacity, you can get a colored monotone kind of effect:

See the Pen Monotone-ing an Image by Chris Coyier (@chriscoyier) on CodePen.

Maarten van der Velde wrote in to say that rather than lowering the opacity, we can combine it with mix-blend-mode and blowing out the contrast:

See the Pen Monotone-ing an Image by Chris Coyier (@chriscoyier) on CodePen.

Amelia Bellamy-Royds also covered using SVG color filters to do this, which has an amazing amount of control:

See the Pen SVG Filters Gray -> Invert Monochrome Color by Amelia Bellamy-Royds (@AmeliaBR) on CodePen.

Comments

  1. User Avatar
    Morgan Lewis
    Permalink to comment#

    Another way to do this, which requires only applying CSS to a single element, is to chain filter effects together:

    .monochrome { filter: sepia(1) saturate(250%) hue-rotate(90deg); }

    That will result in a monochrome green image. Alter saturate and hue-rotate as you desire.

Submit a Comment

Posting Code

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag