msyavuz opened a new pull request, #42700:
URL: https://github.com/apache/superset/pull/42700
### SUMMARY
Picking a light theme as the **system dark theme** breaks dark mode: the UI
renders a mix of light and dark tokens (black borders over otherwise unchanged
styling) instead of a dark UI.
`get_theme_bootstrap_data()` merges the DB-selected theme over the config
base (`_THEME_DARK_BASE`, `algorithm: "dark"`), and the DB theme's `algorithm`
key wins the merge. So a theme authored with `algorithm: "default"` is served
in the dark slot as `default`, and Ant Design derives light-mapped tokens from
dark-leaning seed values.
```
merge(_THEME_DARK_BASE, {"token": {...}, "algorithm": "default"})
-> before: {"token": {...}, "algorithm": "default"} # dark mode renders
light-mapped
-> after: {"token": {...}, "algorithm": "dark"}
```
Each system theme is now served with the algorithm of the slot it fills
(modifiers like `compact` preserved), which also repairs deployments already in
this state. The Themes list additionally warns admins when the theme they are
assigning declares the opposite algorithm.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — no visual change on correctly configured deployments; the fix restores
the theme's normal dark rendering.
### TESTING INSTRUCTIONS
1. Settings → Themes, set a light theme (e.g. `THEME_DEFAULT`) as the system
**dark** theme. A warning now appears in the confirmation dialog.
2. Switch the theme mode to Dark. The UI renders fully dark instead of a
half-themed mix.
3. `pytest tests/unit_tests/themes/test_utils.py
tests/unit_tests/views/test_base_theme_helpers.py`
4. `npm run test -- src/features/themes/utils.test.ts src/pages/ThemeList`
### ADDITIONAL INFORMATION
- [ ] Has associated issue: No
- [ ] Required feature flags: None — `ENABLE_UI_THEME_ADMINISTRATION` is on
by default and is what exposes the broken path
- [x] Changes UI: Yes — a warning alert in the "Set System Default/Dark
Theme" confirmation dialog
- [ ] Includes DB Migration: No
- [ ] Introduces new feature or API: No
- [ ] Removes existing feature or API: No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]