Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement dark mode #233

Merged
merged 32 commits into from
Sep 29, 2023
Merged

Conversation

alphapapa
Copy link
Contributor

@alphapapa alphapapa commented May 16, 2023

See #229.

For better or worse, this branch is based on #230.

This is at an early stage of development.

@netlify
Copy link

netlify bot commented May 16, 2023

Deploy Preview for scientific-python-hugo-theme ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 4226f46
🔍 Latest deploy log https://app.netlify.com/sites/scientific-python-hugo-theme/deploys/6515be85c187180008df823b
😎 Deploy Preview https://deploy-preview-233--scientific-python-hugo-theme.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 95
Accessibility: 98
Best Practices: 100
SEO: 89
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@alphapapa alphapapa force-pushed the wip/229-dark-mode branch 6 times, most recently from 26cfe71 to 85b9c88 Compare May 31, 2023 21:41
@alphapapa
Copy link
Contributor Author

alphapapa commented May 31, 2023

Hi @stefanv @jarrodmillman,

Here are screenshots of the current state of this branch:

Screenshots (click to expand)

Screen Shot 2023-05-31 at 16 42 27-fullpage
Screen Shot 2023-05-31 at 16 43 46-fullpage
Screen Shot 2023-05-31 at 16 43 54-fullpage
Screen Shot 2023-05-31 at 16 44 00-fullpage
Screen Shot 2023-05-31 at 16 44 04-fullpage
Screen Shot 2023-05-31 at 16 44 10-fullpage
Screen Shot 2023-05-31 at 16 44 17-fullpage
Screen Shot 2023-05-31 at 16 44 22-fullpage

I went with an almost-black background for the dark-mode theme, rather than simply "inverting" the light theme directly. If preferred, though, the dark blue color used in the top and bottom bars could be used for the main content, and those bars could be the almost-black color instead.

This is currently implemented using the CSS @media (prefers-color-scheme: dark) special selector. As discussed, I'll be implementing a manual override that can be activated by clicking a switch on the page. Hopefully that can be integrated while keeping this CSS selector so that users who activate the dark-mode preference in the OS or browser will still have it selected automatically.

Please let me know what you think about the visual design, color choices, etc. Thanks.

@alphapapa alphapapa marked this pull request as ready for review May 31, 2023 21:50
@alphapapa alphapapa self-assigned this May 31, 2023
@alphapapa alphapapa added the type: Enhancement New feature or request label May 31, 2023
@stefanv
Copy link
Member

stefanv commented Jun 8, 2023

Thanks @alphapapa! As long as the color mapping is easy to change (which it is), we can always tweak that later. I'd probably do away with the glow, but everything else looks good.

A very simple switcher is implemented in https://github.com/scientific-python/scientific-python-hugo-theme/pull/157/files, in case that's useful to look at.

@stefanv
Copy link
Member

stefanv commented Jun 8, 2023

Many sites (GitHub, e.g.) choose a very dark shade of gray instead of pitch black as the background. Worth playing with?

@stefanv
Copy link
Member

stefanv commented Jul 18, 2023

@henryiii Jarrod mentioned that this is a needed feature for porting the dev guide to Hugo. Did you want to take a look to see whether this implementation would be sufficient? There's no widget for switching, but it does switch based on the theme preference. See:

https://github.com/scientific-python/scientific-python-hugo-theme/pull/233/files#diff-667066e9990bd098c594509db8ed4b5abf1a2e91e092a748e52be5283286f00eR46

@henryiii
Copy link

Jarrod mentioned that this is a needed feature for porting the dev guide to Hugo

Yes, this is the main drawback that I'm aware of for moving over.

There's no widget for switching, but it does switch based on the theme preference

That's fine by me.

FWIW, the shadows on the boxes look bad in the preview, both in dark and especially in light mode.

@jarrodmillman
Copy link
Member

Before

2023-09-14T10:49:14,748992872-07:00

After

2023-09-14T10:49:26,247954365-07:00

@jarrodmillman
Copy link
Member

I updated the theme for all the websites. We are merging this and will fix it up in follow-up PRs. We won't update the websites until we are ready.

@jarrodmillman
Copy link
Member

Before

2023-09-14T10:52:23,914732200-07:00

After

2023-09-14T10:52:17,312123782-07:00

@alphapapa
Copy link
Contributor Author

@jarrodmillman I think the preview is looking pretty good in dark mode now: https://deploy-preview-233--scientific-python-hugo-theme.netlify.app/

Screenshots

deploy-preview-233--scientific-python-hugo-theme netlify app_features_

deploy-preview-233--scientific-python-hugo-theme netlify app_shortcodes_

If you agree, feel free to merge. And please let me know if you see any other changes that should be made. Thanks.

@jarrodmillman
Copy link
Member

The sidebar in dark mode needs some attention.

Light mode

2023-09-14T12:09:14,521202730-07:00

Dark mode

2023-09-14T12:08:44,415249491-07:00

@stefanv
Copy link
Member

stefanv commented Sep 14, 2023

Also the glowy boxes on the frontpage, and the mermaid diagrams (in dark mode).

@jarrodmillman
Copy link
Member

@jarrodmillman
Copy link
Member

jarrodmillman commented Sep 15, 2023

Maybe the button should be white (or lightly colored) with dark text in dark mode? And no shadow.

light

2023-09-15T10:46:45,565750474-07:00

dark

2023-09-15T10:46:30,093935424-07:00

@alphapapa
Copy link
Contributor Author

Rebased on main.

@stefanv
Copy link
Member

stefanv commented Sep 28, 2023

Thanks, this looks good. The only thing I spotted is that pre blocks flow almost into text:

image

I think it's just more visible in dark mode, but we can adjust in both light/dark mode (no need to tweak it in only dark mode).

Then, re: the top banner: in light mode, the top menu and the background (behind Scientific Python) are the same color. By changing it, it creates a visual barrier. I prefer the two to be the same, as in this edited example:

image

@jarrodmillman
Copy link
Member

The failure looks like a network issue on netlify. I restarted it and will see if it works.

@jarrodmillman
Copy link
Member

@stefanv
Copy link
Member

stefanv commented Sep 28, 2023

I spotted one more issue: there's a transition at the bottom of the page which shouldn't be there. The footer color should go to the bottom of the page:


image


(Compare with existing https://scientific-python.org/ footer for an example.)

@stefanv
Copy link
Member

stefanv commented Sep 28, 2023

And then just the pre rendering issue (box running into text) still, and I think we're done.

@alphapapa
Copy link
Contributor Author

I spotted one more issue: there's a transition at the bottom of the page which shouldn't be there. The footer color should go to the bottom of the page:

image

(Compare with existing https://scientific-python.org/ footer for an example.)

Hm, this appears to be a matter of how much the page's footer element contains. For example, the https://theme.scientific-python.org/ page, at full width, looks like this right now:

Screenshot

Screenshot_20230928_130247

While the https://scientific-python.org/ page looks like this right now:

Screenshot

Screenshot_20230928_130516

Fixing that in the theme itself, so that it applies regardless of how large the footer is on the site the theme is applied to, may require some more substantial changes to the CSS or the HTML elements.

@alphapapa
Copy link
Contributor Author

alphapapa commented Sep 28, 2023

Here are screenshots of the current state of the PR:

Details

Screen Shot 2023-09-28 at 13 14 08

Screen Shot 2023-09-28 at 12 57 51

Screen Shot 2023-09-28 at 12 57 56

@jarrodmillman jarrodmillman merged commit 1963dc1 into scientific-python:main Sep 29, 2023
5 checks passed
@jarrodmillman jarrodmillman added this to the 0.2 milestone Sep 29, 2023
@stefanv
Copy link
Member

stefanv commented Sep 29, 2023

Good work, thanks!

@alphapapa alphapapa deleted the wip/229-dark-mode branch October 5, 2023 22:15
alphapapa added a commit to scientific-python/scientific-python.org that referenced this pull request Oct 5, 2023
This fixes the appearance of the .spec-meta class's background color
in dark mode.

This should be merged when the theme submodule is updated to include
<scientific-python/scientific-python-hugo-theme#233>.
alphapapa added a commit to scientific-python/scientific-python.org that referenced this pull request Oct 11, 2023
This fixes the appearance of the .spec-meta class's background color
in dark mode.

This should be merged when the theme submodule is updated to include
<scientific-python/scientific-python-hugo-theme#233>.
alphapapa added a commit to scientific-python/scientific-python.org that referenced this pull request Oct 12, 2023
This fixes the appearance of the .spec-meta class's background color
in dark mode.

This should be merged when the theme submodule is updated to include
<scientific-python/scientific-python-hugo-theme#233>.
jarrodmillman pushed a commit to scientific-python/scientific-python.org that referenced this pull request Oct 12, 2023
This fixes the appearance of the .spec-meta class's background color
in dark mode.

This should be merged when the theme submodule is updated to include
<scientific-python/scientific-python-hugo-theme#233>.
stefanv added a commit to stefanv/scientific-python-hugo-theme that referenced this pull request Aug 16, 2024
stefanv added a commit that referenced this pull request Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement "dark mode" support
4 participants