Tailwind CSS Hue Rotate
Hue Rotate
将色调旋转滤镜应用于元素的实用程序。
|
Class
|
Properties
|
|---|---|
| -hue-rotate-180 | --tw-hue-rotate: hue-rotate(-180deg); |
| -hue-rotate-90 | --tw-hue-rotate: hue-rotate(-90deg); |
| -hue-rotate-60 | --tw-hue-rotate: hue-rotate(-60deg); |
| -hue-rotate-30 | --tw-hue-rotate: hue-rotate(-30deg); |
| -hue-rotate-15 | --tw-hue-rotate: hue-rotate(-15deg); |
| hue-rotate-0 | --tw-hue-rotate: hue-rotate(0deg); |
| hue-rotate-15 | --tw-hue-rotate: hue-rotate(15deg); |
| hue-rotate-30 | --tw-hue-rotate: hue-rotate(30deg); |
| hue-rotate-60 | --tw-hue-rotate: hue-rotate(60deg); |
| hue-rotate-90 | --tw-hue-rotate: hue-rotate(90deg); |
| hue-rotate-180 | --tw-hue-rotate: hue-rotate(180deg); |
用法
在 filter 实用程序旁边使用 hue-rotate-{amount} 实用程序来旋转元素的色调。
<div class="filter hue-rotate-15 ...">
<!-- ... -->
</div>响应式
要在特定断点处控制元素的色调旋转,请在任何现有的色调旋转实用程序中添加 {screen}: 前缀。例如,使用 md:hue-rotate-60 将 hue-rotate-60 实用程序仅应用于中等大小及以上的屏幕尺寸。
<div class="filter hue-rotate-15 md:hue-rotate-60 ...">
<!-- ... -->
</div>有关 Tailwind 响应式设计功能的更多信息,请查看响应式设计文档。
自定义
您可以使用 tailwind.config.js 文件的主题部分中的 hueRotate 键自定义生成哪些 hue-rotate 实用程序。
// tailwind.config.js
module.exports = {
theme: {
extend: {
hueRotate: {
'-270': '-270deg',
270: '270deg',
}
}
}
}在主题自定义文档中了解有关自定义默认主题的更多信息。
变体
默认情况下, 针对 hue-rotate 功能类,只生成 responsive 变体。
您可以通过修改您的 tailwind.config.js 文件中的 variants 部分中的 hueRotate 属性来控制为 hue-rotate 功能生成哪些变体。
例如,这个配置也将生成 hover and focus 变体:
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
hueRotate: ['hover', 'focus'],
}
}
}禁用
如果您不打算在您的项目中使用 hue-rotate 功能,您可以通过在配置文件的 corePlugins 部分将 hueRotate 属性设置为 false 来完全禁用它们:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
hueRotate: false,
}
}