Skip to content

Added dark theme switch to last dropdown menu#6352

Merged
dlmarion merged 5 commits intoapache:mainfrom
dlmarion:dark-mode-pref2
May 5, 2026
Merged

Added dark theme switch to last dropdown menu#6352
dlmarion merged 5 commits intoapache:mainfrom
dlmarion:dark-mode-pref2

Conversation

@dlmarion
Copy link
Copy Markdown
Contributor

No description provided.

@dlmarion dlmarion added this to the 4.0.0 milestone Apr 30, 2026
@dlmarion dlmarion self-assigned this Apr 30, 2026

a {
text-decoration: none;
color: #0000ff;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed these colors from the links and replaced it with the link-body-emphasis CSS class. As documented here, it's the only color class that adapts to color.

@keith-turner
Copy link
Copy Markdown
Contributor

Tried running this and noticed the tables borders in dark mode seems really bright, like they are a strong white. When looking at the table borders in normal mode they are a light gray so they do not draw so much attention and they do not contrast so strongly w/ the background. Would be nice of the table borders in dark mode do not contrast so much w/ the background color.

Also noticed that the way you toggle dark mode differs from the auto refresh which is also a toggle, would be nice to make them both consistent. To me whatever the dark mode toggle is doing seems better.

@dlmarion
Copy link
Copy Markdown
Contributor Author

dlmarion commented May 1, 2026

Tried running this and noticed the tables borders in dark mode seems really bright, like they are a strong white. When looking at the table borders in normal mode they are a light gray so they do not draw so much attention and they do not contrast so strongly w/ the background. Would be nice of the table borders in dark mode do not contrast so much w/ the background color.

It looks like DataTables already works with dark mode, but we were specifying a color for the table borders so we were overriding the behavior in both cases. I found a CSS function called light-dark that allows us to specify both colors that we want to use when we are overriding depending on the mode. I applied this to the table border only, check it out. I think it looks better. We can use this approach to adjust other items.

Also noticed that the way you toggle dark mode differs from the auto refresh which is also a toggle, would be nice to make them both consistent. To me whatever the dark mode toggle is doing seems better.

I did look at the Auto-Refresh menu item to see if I could change it. It appeared to be taking advantage of some provided feature. I can look again, but maybe in a different PR.

@dlmarion
Copy link
Copy Markdown
Contributor Author

dlmarion commented May 1, 2026

Also noticed that the way you toggle dark mode differs from the auto refresh which is also a toggle, would be nice to make them both consistent. To me whatever the dark mode toggle is doing seems better.

I did look at the Auto-Refresh menu item to see if I could change it. It appeared to be taking advantage of some provided feature. I can look again, but maybe in a different PR.

#6355 fixed this.

@DomGarguilo
Copy link
Copy Markdown
Member

When dark mode is enabled and I refreshed the page, I got a flash of the non-dark mode page. I tried moving the reading/loading earlier and found this to work:

    <script>
      (function() {
        if (localStorage.getItem('dark-theme-enabled') === 'true') {
          document.documentElement.setAttribute('data-bs-theme', 'dark');
        }
      })();
    </script>

I put that in the <head> in defaul.ftl and the flashing is not longer present.

@DomGarguilo
Copy link
Copy Markdown
Member

I also am pretty sure we can allow things to be switched between light and dark mode without having to refresh the page but I am still looking into how that could be done

@dlmarion
Copy link
Copy Markdown
Contributor Author

dlmarion commented May 4, 2026

I also am pretty sure we can allow things to be switched between light and dark mode without having to refresh the page but I am still looking into how that could be done

Ok, that would be good. I'm not sure that I would spend too much time on it as I would not expect a user to switch between light and dark modes very often. I would imagine that the user would pick one and stick with it. Feel free to put up a PR with any changes and I'll merge it in.

* Avoid light mode flash on refresh

* Avoid having to refresh page when dark mode changes

* add comment
Copy link
Copy Markdown
Member

@DomGarguilo DomGarguilo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. things are working well. The only thing I noticed was the navbar becomes the same color as the background in dark mode but that is very minor.

@dlmarion dlmarion merged commit 27d0fd0 into apache:main May 5, 2026
9 checks passed
@dlmarion dlmarion deleted the dark-mode-pref2 branch May 5, 2026 15:26
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.

3 participants