Last active
January 23, 2024 08:15
-
-
Save arixwap/07edb2c4b866a875b12de2e24fbdc054 to your computer and use it in GitHub Desktop.
Create text stroke color in Tailwind CSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="text-stroke-red-500"> | |
Your text | |
</div> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const plugin = require("tailwindcss/plugin"); | |
module.exports = { | |
theme: { | |
// Your tailwind config | |
// ... | |
}, | |
plugins: [ | |
plugin(function ({ matchUtilities, theme }) { | |
matchUtilities( | |
{ | |
// TODO: not work with color-value, example red-500 | |
"text-stroke": (value) => ({ | |
"-webkit-text-stroke": `1px ${value}`, | |
}), | |
}, | |
{ | |
values: theme("colors"), | |
} | |
); | |
}) | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment