Utilities for styling the fill of SVG elements.
Use fill-current
to set the fill color of an SVG to the current text color. This makes it easy to set an element’s fill color by combining this class with an existing text color utility.
Useful for styling icon sets like Zondicons that are drawn entirely with fills.
<svg class="fill-current text-green-600 ..."></svg>
Control which fill utilities Tailwind generates by customizing the theme.fill
section of your tailwind.config.js
file:
// tailwind.config.js
module.exports = {
theme: {
- fill: {
- current: 'currentColor',
- }
+ fill: theme => ({
+ 'red': theme('colors.red.500'),
+ 'green': theme('colors.green.500'),
+ 'blue': theme('colors.blue.500'),
+ })
}
}
默認情況下, 只有 響應式 的 fill 變化模式 (variants) 會產生。
在 tailwind.config.js
的 variants
區塊中變更 fill
屬性來決定有哪些變化模式會生成。
舉個例子來說,這個設定將會生成 響應式 和 hover 的變化模式。
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
+ fill: ['responsive', 'hover'],
}
}
}
如果你不打算在專案中使用 fill 功能,可以在你的設定檔裡的 corePlugins
屬性中將 fill
設定為 false
來停用功能:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ fill: false,
}
}