[Adding Themes to QFMD] - Implementation Grind #316
KofTwentyTwo
announced in
Daily Build Log
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The Implementation Grind
First attempt:
Doesn't work. MUI generates class names like
.css-1hw9j7sand injects them with inline-level specificity. Regular stylesheets don't stand a chance.!importantit is:Not elegant, but effective. Buttons, inputs, cards - all picking up theme colors now.
Then a weirder problem. A test for
textSecondarykeeps failing even though the CSS variable is set correctly and the value matches.After debugging: the test was finding a
.MuiTypography-body2element in the sidebar, not the main content. The sidebar has its own text color variable. The test found an element, checked its color, but checked the wrong element.The fix:
"Apply this style, but not if inside the drawer."
Same pattern needed for the branded header - it has its own text color too. So now there are
:not()selectors everywhere.The CSS override file is around 1200 lines now. Organized by component group:
Each section targets the MUI classes for that component type and forces them to use CSS variables.
What's working: font family and sizes flow through cleanly. Border radius applies everywhere. Table headers picked up the colors without issues. Sidebar selected and hover states work correctly.
Next: actual browser tests. Playwright, not Jest. Render the page and check
getComputedStyle(). The tests need to verify what the user actually sees, not just that variables are set.All reactions