Skip to content

Instantly share code, notes, and snippets.

@arixwap
Last active January 23, 2024 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arixwap/07edb2c4b866a875b12de2e24fbdc054 to your computer and use it in GitHub Desktop.
Save arixwap/07edb2c4b866a875b12de2e24fbdc054 to your computer and use it in GitHub Desktop.
Create text stroke color in Tailwind CSS
<div class="text-stroke-red-500">
Your text
</div>
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