Skip to content

Grayscale

Applies a grayscale filter to an element.

Utility Properties
No data found

This example showcases various grayscale filter values: 0%, 50%, and 100%.

  • The f-g-0 utility sets the filter property to grayscale(0%), meaning no grayscale is applied, and the colors remain unchanged.
  • The f-g-50 utility sets the filter property to grayscale(50%), applying a moderate grayscale effect, resulting in a mix of color and gray.
  • Finally, f-g-100 utility sets the filter property to grayscale(100%), completely removing all color and rendering the element in shades of gray.
<div class="d-g g-16 gtc-1 sm:gtc-3">
<div class="d-32 p-r rad-1">
<img class="d-full f-g-0 of-c rad-1" src="https://picsum.photos/300?image=875" />
</div>
<div class="d-32 p-r rad-1">
<img class="d-full f-g-50 of-c rad-1" src="https://picsum.photos/300?image=875" />
</div>
<div class="d-32 p-r rad-1">
<img class="d-full f-g-100 of-c rad-1" src="https://picsum.photos/300?image=875" />
</div>
</div>

Conditional styles

Learn how to override existing utilities based on the user's screen size or other factors, such as hover states.

Media modifiers

You can combine responsive breakpoints like sm:f-g-*,md:f-g-*, lg:f-g-*, and xxl:f-g-* allows targeting specific utilities in different viewports.

<div class="f-g-0 md:f-g-100 ..."></div>
Hover modifiers

Alternatively, you can apply :hover by using h:f-g-* utility to override elements and change their values when hovering over them.

<div class="f-g-0 h:f-g-100 ..."></div>