Tailwind CSS Backdrop Hue Rotate

2022-08-11 10:15 更新

Backdrop Hue Rotate

用于將背景色相旋轉(zhuǎn)濾鏡應(yīng)用于元素的實(shí)用程序。

Class
Properties
-backdrop-hue-rotate-180 --tw-backdrop-hue-rotate: hue-rotate(-180deg);
-backdrop-hue-rotate-90 --tw-backdrop-hue-rotate: hue-rotate(-90deg);
-backdrop-hue-rotate-60 --tw-backdrop-hue-rotate: hue-rotate(-60deg);
-backdrop-hue-rotate-30 --tw-backdrop-hue-rotate: hue-rotate(-30deg);
-backdrop-hue-rotate-15 --tw-backdrop-hue-rotate: hue-rotate(-15deg);
backdrop-hue-rotate-0 --tw-backdrop-hue-rotate: hue-rotate(0deg);
backdrop-hue-rotate-15 --tw-backdrop-hue-rotate: hue-rotate(15deg);
backdrop-hue-rotate-30 --tw-backdrop-hue-rotate: hue-rotate(30deg);
backdrop-hue-rotate-60 --tw-backdrop-hue-rotate: hue-rotate(60deg);
backdrop-hue-rotate-90 --tw-backdrop-hue-rotate: hue-rotate(90deg);
backdrop-hue-rotate-180 --tw-backdrop-hue-rotate: hue-rotate(180deg);

用法

使用 ?background-hue-rotate-{amount}? 實(shí)用程序和 ?backdrop-filter? 實(shí)用程序來(lái)旋轉(zhuǎn)元素背景的色調(diào)。

<div class="backdrop-filter backdrop-hue-rotate-15 ...">
  <!-- ... -->
</div>

響應(yīng)式

要在特定斷點(diǎn)處控制元素的背景色調(diào)旋轉(zhuǎn),請(qǐng)?jiān)谌魏维F(xiàn)有的背景色調(diào)旋轉(zhuǎn)實(shí)用程序中添加 ?{screen}:? 前綴。例如,使用 ?md:backdrop-hue-rotate-60? 僅在中等屏幕尺寸及以上尺寸應(yīng)用 ?backdrop-hue-rotate-60? 實(shí)用程序。

<div class="backdrop-filter backdrop-hue-rotate-15 md:backdrop-hue-rotate-60 ...">
  <!-- ... -->
</div>

有關(guān) Tailwind 響應(yīng)式設(shè)計(jì)功能的更多信息,請(qǐng)查看響應(yīng)式設(shè)計(jì)文檔。

自定義

您可以使用 ?tailwind.config.js? 文件的 ?theme ?部分中的 ?backgroundHueRotate ?鍵自定義生成哪些 ?backdrop-hue-rotate? 實(shí)用程序。

  // tailwind.config.js
  module.exports = {
    theme: {
     extend: {
       backdropHueRotate: {
         '-270': '-270deg',
         270: '270deg',
       }
     }
    }
  }

主題自定義文檔中了解有關(guān)自定義默認(rèn)主題的更多信息。

變體

默認(rèn)情況下, 針對(duì) backdrop hue-rotate 功能類(lèi),只生成 responsive 變體。

您可以通過(guò)修改您的 ?tailwind.config.js? 文件中的 ?variants ?部分中的 ?backdropHueRotate ?屬性來(lái)控制為 backdrop hue-rotate 功能生成哪些變體。

例如,這個(gè)配置也將生成 hover and focus 變體:

  // tailwind.config.js
  module.exports = {
    variants: {
      extend: {
        // ...
       backdropHueRotate: ['hover', 'focus'],
      }
    }
  }

禁用

如果您不打算在您的項(xiàng)目中使用 backdrop hue-rotate 功能,您可以通過(guò)在配置文件的 ?corePlugins ?部分將 ?backdropHueRotate ?屬性設(shè)置為 ?false ?來(lái)完全禁用它們:

  // tailwind.config.js
  module.exports = {
    corePlugins: {
      // ...
     backdropHueRotate: false,
    }
  }


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)