Applying Hue Rotation on Image using CSS3

In this tutorial, we will learn how to apply hue rotation on an image using CSS3? By Apurva Mathur Last updated : July 26, 2023

Appearance is one of the most important aspects of a website. Visual appeal is what meets the eye. It's the colors, shapes, pictures, fonts, white space, and overall visual balance of a design. Whether a website appeal to us affects how we perceive it, how we use it, and how we remember it.

Appearance says a lot about your website that is the one thing that attracts the attention of the audience. This is key to getting visitors engaged with your website. We like to look at pretty things and if we have the choice, we always prefer an attractive design or image over an ugly or neutral one.

Hue Rotation on Image using CSS3

Hue rotation is often an easy way to change the appearance of a plot or figure without the need to create a new color bar. The value defines the number of degrees around the color circle the image samples will be adjusted. In CSS we apply hue-rotation on the image using the filter property. From many values of filter property, hue-rotation is one of the values.

Its value is always given in degree.

Syntax to apply hue-rotation with filter proper

Below is the syntax of CSS filter property with hue-rotation:

filter: hue-rotation (value deg);

Example to apply hue-rotation on image using CSS3

<!DOCTYPE html>
    <meta name="viewport" content="width=device-width, initial-scale=1">
      margin: 20px;
      width: 600px;
      height: 500px;
      img.hue-rotation {
      width: 600px;
      height: 500px;
        <h1>Orignal Image VS Hue-rotation filter property</h1>
      <img class="normal" src="">
      <img class="hue-rotation" src="">

The output of the above example is:

Example: Hue Rotation on Image using CSS3

CSS Examples »

Comments and Discussions!

Load comments ↻

Copyright © 2024 All rights reserved.