1. 滤镜
  2. 饱和

滤镜

过滤器:饱和度(saturate())

应用饱和度滤镜到元素的工具类。

ClassStyles
saturate-<number>
filter: saturate(<number>%);
saturate-(<custom-property>)
filter: saturate(var(<custom-property>));
saturate-[<value>]
filter: saturate(<value>);

示例

基本示例

使用像 saturate-50saturate-100 这样的工具类来控制元素的饱和度:

saturate-50

saturate-100

saturate-150

saturate-200

<img class="saturate-50 ..." src="/img/mountains.jpg" />
<img class="saturate-100 ..." src="/img/mountains.jpg" />
<img class="saturate-150 ..." src="/img/mountains.jpg" />
<img class="saturate-200 ..." src="/img/mountains.jpg" />

使用自定义值

Use the saturate-[<value>] syntax to set the 饱和度 based on a completely custom value:

<img class="saturate-[.25] ..." src="/img/mountains.jpg" />

For CSS variables, you can also use the saturate-(<custom-property>) syntax:

<img class="saturate-(--my-saturation) ..." src="/img/mountains.jpg" />

This is just a shorthand for saturate-[var(<custom-property>)] that adds the var() function for you automatically.

响应式设计

Prefix a filter: saturate() utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:

<img class="saturate-50 md:saturate-150 ..." src="/img/mountains.jpg" />

Learn more about using variants in the variants documentation.