Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add text-decoration-color utilities #5760

Merged
merged 6 commits into from
Oct 12, 2021

Conversation

MichaelAllenWarner
Copy link
Contributor

@MichaelAllenWarner MichaelAllenWarner commented Oct 11, 2021

Adds utilities for the text-decoration-color property (including opacity utilities) [EDIT: no dedicated opacity utilities], as green-lit here.

Example usage:

<a href="#" class="underline decoration-blue hover:decoration-blue/50">Link with blue underline that dims on hover</a>

Michael Warner and others added 4 commits October 11, 2021 15:06
Add `text-decoration-color` utilities (including opacity utilities)
change 'backgroundColor' to 'textDecorationColor' in corePlugin declaration for latter
@MichaelAllenWarner
Copy link
Contributor Author

The instructions for creating a /dist/tailwind.css file for testing manually did not work for me. Neither did the npm run babelify part of the instructions just before. They may be out of date.

@lukewarlow
Copy link
Contributor

I think this is doing the same as #5762 is trying to.

@adamwathan
Copy link
Member

Thanks for this! Can we ditch the textDecorationOpacity plugin? Going forward for new color stuff I want to just encourage the shorthand syntax (decoration-red-500/25), and only keep existing color opacity stuff for backwards compatibility.

Good to merge after that stuff is removed!

The instructions for creating a /dist/tailwind.css file for testing manually did not work for me. Neither did the npm run babelify part of the instructions just before. They may be out of date.

Yeah these are definitely out of date — what you have testing-wise here is great 👍

@MichaelAllenWarner
Copy link
Contributor Author

@adamwathan

Sure thing.

I have a quick question. For this line in corePlugins.js:

{ values: flattenColorPalette(theme('textDecorationColor')), type: 'color' }

should the type be 'color' or ['color', 'any']? Looking at other color-related utilities I'm seeing both.

@MichaelAllenWarner
Copy link
Contributor Author

(It looks like 'any' is needed to allow CSS variables as bracketed values in JIT mode, so I'm going with that unless you object.)

@lukewarlow
Copy link
Contributor

I believe the any is for arbitrary value support.

Michael Warner and others added 2 commits October 12, 2021 08:53
remove explicit textDecorationOpacity utility (JIT slash syntax suffices)
@MichaelAllenWarner MichaelAllenWarner changed the title Add text-decoration-color utilities (including opacity utilities) Add text-decoration-color utilities Oct 12, 2021
@MichaelAllenWarner
Copy link
Contributor Author

MichaelAllenWarner commented Oct 12, 2021

Explicit opacity utilities have been removed.

I ran npm run test after switching one of the tests in color-opacity-modifiers.test.js from a background-color check to a text-decoration-color check, and it passed, so it looks like the JIT slash syntax is working (I did not overwrite the file with that change, however).

@adamwathan adamwathan merged commit 8259dfd into tailwindlabs:master Oct 12, 2021
@adamwathan
Copy link
Member

Looks great, thank you! 🙌🏻

@kripod
Copy link

kripod commented Oct 31, 2021

This is a great addition! I think the default tokens should be inferred from textColor rather than just color, similarly to how divideColor inherits its defaults from borderColor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants