feat: Add dark/light mode toggler#4872
Conversation
michaelkedar
left a comment
There was a problem hiding this comment.
😎 looking good to me.
I find the white text on red buttons on white background a bit harsh - I don't know if you feel like experimenting with the colours a bit.
Also, FYI there are some code blocks in a few blog posts (e.g. https://osv.dev/blog/posts/using-the-determineversion-api/) that don't seem to be changing with light mode. I think it's fine to leave as-is (because I suspect it'd be a hassle to change), I'm just not sure if you saw those.
There was a problem hiding this comment.
I think these logos look more pixelated than the white-text ones?
I've tried looking around, but I can't find the original source of these images.
The GitHub docs use a different icon - I'm not against changing to use those instead.
There was a problem hiding this comment.
Thanks! I'll let @cuixq propose the colours.
I find the white text on red buttons on white background a bit harsh
It's possible to minimise this also by remove/lightening the button fill:

Let me know if you think that's the right move.
Also, FYI there are some code blocks in a few blog posts
I left this out since it's a bit hacky to make this dynamically apply a theme based on light/dark mode. The issue is that <code> block styling is statically configured in hugo.toml. It's possible to 'escape hatch' this though and apply CSS ourselves. I've done this after generating the CSS with:
hugo gen chromastyles --style=native
hugo gen chromastyles --style=github
Example screenshot of light theme code blocks:
There are more syntax highlighting schemes to choose from: https://gohugo.io/quick-reference/syntax-highlighting-styles/.
I think these logos look more pixelated than the white-text ones?
I've extracted the logo you suggested and replaced it in both dark/light mode with a higher resolution version. It no longer looks pixelated to me :)
d3cd4c0 to
f41adb9
Compare
f41adb9 to
262265b
Compare
|
Sorry @cuixq, you had out of date changes because I was clumsy and force pushed a much older commit by accident. I've recovered the proper commit now and all those issues should be corrected now! :) (Also changed the light mode blog code syntax highlighting from |
3f140c2 to
6ed09c9
Compare
|
Thanks @cuixq! I've implemented all suggestions: Dimmed the red of the blog post title: Dimmed the red of the "No fix available" chip: Inverted package tab active/inactive colours and thickened the highlighting bottom border as you showed: |
|
looks great! thank you! only one comment about "Read more..." on the blog page, can we make it the same color as the blog title too? it seems have different red color. |
6ed09c9 to
e70bf51
Compare
There was a problem hiding this comment.
The new light mode looks great!
Though I did notice a few changes that are different in dark mode compared to what's currently on Prod.
Things I noticed flipping back and forth on prod and test:
Different shade of background colorOk this one might just be an optical illusion because of the text color changing.- Search box no longer has a gray bg
- separator lines between each element in the search is missing or very hard to see
- text color changed from 0.87 opacity to 1, making all the text look bolder
- Github logo on the top right has shrunk in size.
Can some of these changes be reverted / kept consistent with the current changes in dark mode?











Why? Offering light/dark mode improves accessibility and legibility for web content. Light/dark themes are now an expectation for any modern tooling that developers interact with.
osv.light.mode.demo.webm
Caveats:
make run-website-emulatorbecause I don't have access to the real osv dataset - so perhaps the default emulator data is not representative of the styles that would be seen in production on real data. A thorough look against real data would be helpful to find conflicting/unresolved styles.