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 theme variables to head #30

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kremalicious
Copy link

@kremalicious kremalicious commented Mar 14, 2024

Long story short, adding all these custom properties directly onto the html style attribute is kinda rude and creates a bad developer experience:

Screenshot 2024-03-14 at 10 24 39

This also applies to everyone using popular wallet libraries like @rainbow-me's Rainbowkit or @family's Connectkit, as they all use this library.

Solution

This PR proposes to add all theme-related custom properties into a style tag within the head under the :root pseudo class. Resulting in a clean DOM without any changes in functionality:

Screenshot 2024-03-14 at 10 30 48

Possible Issues

Moving CSS declarations from html style property to head style tag decreases their specificity. Which in theory should not be an issue here as we only deal with custom properties with no actual CSS rules. But as there are no tests to check this out quickly, let me know if you can think of any more issues arising because of this reduced specificity.

And finally, here's a scientific representation of developer experience improvements after using this PR:

8j7mth

@kremalicious kremalicious changed the title add theme variables to head add theme variables to head Mar 14, 2024
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.

1 participant