HugoBlox / hugo-blox-builder

🚨 GROW YOUR AUDIENCE WITH HUGOBLOX! 🚀 HugoBlox is an easy, fast no-code website builder for researchers, entrepreneurs, data scientists, and developers. Build stunning sites in minutes. 适合研究人员、企业家、数据科学家和开发者的简单快速无代码网站构建器。用拖放功能、可定制模板和内置SEO工具快速创建精美网站!
https://hugoblox.com/templates/
MIT License
8.19k stars 2.9k forks source link

Windows 10 dark/light settings override hugo-academic theme settings #1526

Closed vince-p closed 4 years ago

vince-p commented 4 years ago

Describe the bug

I would like my website to use the "mr robot" theme with a white background regardless of my system settings. Setting "light = true" in a customised version of the theme does not allow this. Also, when deploying the site to netlify, the theme settings do not render the same way as when I serve the site locally.

Other users have reported similar issues: https://spectrum.chat/academic/help/problem-with-light-theme~05c65080-e797-4c65-998b-290b438357d4

To Reproduce

  1. Set windows to use dark colours (Settings -> Personalisation - Colours -> Choose your colour"
  2. In params.toml, set "day_night" to false
  3. Create data\themes\newtheme.toml (a copy of \themes\academic\data\themes\mr_robot.toml)
  4. In newtheme.toml, set "light = true"
  5. In params.toml, set theme to "newtheme"

This always results in a dark theme. There does not appear to be any way to ignore the system colour settings.

Note - setting "day_night = true" SOMETIMES allows setting a light theme manually once the page loads, but this seems to function inconsistently.

Expected behavior

When I set "light = true" in a custom theme, I expected that the theme would always be light regardless of system settings. If this is not the intended function, could we please have a way to ignore the system colour settings.

Technical details:

vince-p commented 4 years ago

It does feel like something is not working quite right with these settings. I spent a lot of time trying to enforce light mode, and did try clearing the browser cache but that does not change the pattern I've described above.

gcushen commented 4 years ago

Thanks for reporting this. After re-reading through the details and hearing your results of clearing local data for the site in the web browser, we've released a fix so auto day/night only works when the day_night mode is enabled. You can update to the latest master version to test out the fix.

vince-p commented 4 years ago

Thanks for reopening this - much appreciated! I have updated to try this fix but it does not seem to work. When I serve my site locally, it does show up with a light background but when I deploy to netlify, then everything appears as dark. I have tried using a customised version of the mr_robot theme, with "light=true". With those settings, when I serve locally, the color scheme has black text on grey background and is not readable. When I deploy to netlify I get white text on a dark background. I cannot figure out how to get a white background on netlify.

The live website is here: https://vincep.cogscience.org/ The github repository is here: https://github.com/vince-p/academicprofile

robertwwalker commented 4 years ago

I think this is related to some messing with the parse_theme in layouts/partials/functions/. The relevant part is:

{{ if $theme.light }} {{- $scr.Set "background" ($theme.background | default "#fff") -}} {{- $scr.Set "dark_background" "rgb(40, 42, 54)" -}} {{- $scr.Set "home_section_odd" $theme.home_section_odd -}} {{- $scr.Set "home_section_even" $theme.home_section_even -}} {{- $scr.Set "dark_home_section_odd" "hsla(231, 15%, 18%, 1)" -}} {{- $scr.Set "dark_home_section_even" "hsla(231, 15%, 16%, 1)" -}} {{ else }} {{- $scr.Set "background" ($theme.background | default "#fff") -}} {{- $scr.Set "dark_background" ($theme.dark.background | default "rgb(40, 42, 54)") -}} {{- $scr.Set "home_section_odd" "rgb(255, 255, 255)" -}} {{- $scr.Set "home_section_even" "rgb(247, 247, 247)" -}} {{- $scr.Set "dark_home_section_odd" $theme.home_section_odd -}} {{- $scr.Set "dark_home_section_even" $theme.home_section_even -}} {{ end }}

When I updated to the newest version, I found myself redefining parts of this for a complete day/night theme but my solution is a rather personalized hack.