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