Replies: 8 comments 3 replies
-
I'm looking for the same feature. Pending the opinion of @adamwathan I'd be happy to write tests and submit a PR for this feature. |
Beta Was this translation helpful? Give feedback.
-
Where does this go? a { &:hover { |
Beta Was this translation helpful? Give feedback.
-
If it's helpful to anyone, here is the modified plugin function I wrote to use nested colors: //tailwind.config.js
const plugin = require('tailwindcss/plugin')
const _ = require('lodash')
const returnTextDecorationColorMapping = function(e, colors, prefix = null) {
return _.flatMap(colors, (color, name) => {
if (typeof color === 'string' || color instanceof String) {
let fullName = (prefix) ? `${prefix}-${name}` : name
return {
[`.decoration-color-${e(fullName)}`]: {
textDecorationColor: `${color}`
}
}
} else {
let newPrefix = (prefix) ? `${prefix}-${name}` : name
return returnColorMapping(e, color, newPrefix)
}
})
}
...
plugins: [
...,
plugin(function({ addUtilities, e, theme, variants}) {
const colors = theme('colors', {})
const decorationVariants = variants('textDecoration', [])
const textDecorationColorUtility = returnTextDecorationColorMapping(e, colors)
addUtilities(textDecorationColorUtility, decorationVariants)
}),
], |
Beta Was this translation helpful? Give feedback.
-
I am creating a custom Check out the Tailwind Play using transpiled source: https://play.tailwindcss.com/tQSnU0tOUe I requested for naming convention #4165 last week as the name can be quite long. The plan is to support all Still working on adding tests/storybook (and haven't published the composable version to NPM yet). |
Beta Was this translation helpful? Give feedback.
-
Surprised this one hasn't made it to core yet. All the majors browsers have supported it for some time (Safari since v. 8, believe it or not; without the -webkit prefix since v. 12.1), and I've recently seen more requests from designers for customized underline colors (and opacities). IMO, well-supported color-related properties like this deserve special consideration for integration as core utilities because custom plugins that loop through |
Beta Was this translation helpful? Give feedback.
-
Happy to accept a PR for this one at this point! Probably just as |
Beta Was this translation helpful? Give feedback.
-
Decoration opacity would be nice as an option at least. It's the cleanest way of transitioning the text decoration opacity, since transitions between |
Beta Was this translation helpful? Give feedback.
-
It would be useful to have out of the box styling for the
text-decoration-color
property. It is widely supported and it would be useful for styling links primarily. Although it is not a crucial feature.For anybody wanting to do this, I've made a utility that extends your theme config colours and adds the decoration-color class for the same variants as textColor.
then you could do something like this
@apply
version if you really need it:You will need to expand the function above for nested colours though.
Beta Was this translation helpful? Give feedback.
All reactions