Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.

add theme variables to head#30

Open
kremalicious wants to merge 1 commit intoWalletConnect:mainfrom
kremalicious:style-tag
Open

add theme variables to head#30
kremalicious wants to merge 1 commit intoWalletConnect:mainfrom
kremalicious:style-tag

Conversation

@kremalicious
Copy link
Copy Markdown

@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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant