Effects
Utilities for controlling how an SVG element's mask is interpreted.
Class | Styles |
---|---|
mask-type-alpha | mask-type: alpha; |
mask-type-luminance | mask-type: luminance; |
Use the mask-type-alpha
and mask-type-luminance
utilities to control the type of an SVG element's mask:
mask-type-alpha
mask-type-luminance
<svg> <mask id="blob1" class="mask-type-alpha fill-gray-700/70"> <path d="..."></path> </mask> <image href="/img/mountains.jpg" height="100%" width="100%" mask="url(#blob1)" /></svg><svg> <mask id="blob1" class="mask-type-luminance fill-gray-700/70"> <path d="..."></path> </mask> <image href="/img/mountains.jpg" height="100%" width="100%" mask="url(#blob1)" /></svg>
When using mask-type-luminance
the luminance value of the svg mask determines visibility, so sticking with grayscale colors will produce the most predictable results. With mask-alpha
, the opacity of the svg mask determines the visibility of the masked element.
Prefix a mask-type
utility with a breakpoint variant like md:
to only apply the utility at medium screen sizes and above:
<div class="mask-type-alpha md:mask-type-luminance ..."> <!-- ... --></div>
Learn more about using variants in the variants documentation.