You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "dosubot[bot] (via GitHub)" <gi...@apache.org> on 2026/05/02 03:10:32 UTC
Re: [D] Is it possible to detect the currently active theme/theme algorithm (light/dark) from custom/external CSS in Apache Superset? [superset]
GitHub user dosubot[bot] edited a comment on the discussion: Is it possible to detect the currently active theme/theme algorithm (light/dark) from custom/external CSS in Apache Superset?
<!-- Answer -->
Superset does not currently expose any CSS hooks, variables, attributes, or class names in the DOM that indicate the active theme (light/dark) for use in custom or external CSS. Theme state is managed internally via a Theme class and ThemeController, using an `algorithm` property and localStorage, but this is not accessible to CSS selectors outside the React/Emotion/Ant Design theming system ([Theme.tsx](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/src/theme/Theme.tsx), [ThemeController.tsx](https://github.com/apache/superset/blob/master/superset-frontend/src/theme/ThemeController.tsx)).
A common workaround is to use CSS media queries like `prefers-color-scheme: dark`, but this only works if the user's system preference matches the Superset theme mode ([PR #35129](https://github.com/apache/superset/pull/35129)). There are no documented plans or open issues to expose theme indicators for custom/external CSS in future versions.
If you need conditional styling, you could use JavaScript to read the theme mode from localStorage (e.g., `superset-theme-mode`) and add a class to the `<body>` or `<html>` element, but this is not officially supported and would require custom scripting. For now, best practice is to use Superset's theme configuration and tokens, or rely on system-level media queries where possible.
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).*
---
Docs are dead. Just use [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-tagline&utm_term=apache%2Fsuperset).
[](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-feedback&utm_term=apache%2Fsuperset&message_id=aa13efdb-6916-4b2d-87e8-587cc75043d3) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-ask-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-share-team&utm_term=apache%2Fsuperset)
GitHub link: https://github.com/apache/superset/discussions/37035#discussioncomment-15468498
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org