Open noraj opened 3 years ago
Thanks for opening this issue, maintainers will get back to you as soon as possible!
PS: Yes I have read https://theme-next.js.org/docs/theme-settings/#Dark-Mode, #1602, #1599
NexTNexT User Docs – Theme Settings
In thought of an inheritance issue but setting it in theme_config
or the site config doesn't solve the problem.
theme_config:
darkmode: true
Even forcing teh value in node_modules/hexo-theme-next/_config.yml
doesn't change it.
While served with hexo server
or python -m http.server
or ruby -run -ehttpd
(webrick) the dark mode is not working, but surprisingly, in while served by Gitlab Pages after being generated by Gitlab CI the dark mode works.
My gitlab-ci config:
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/node/tags/
# https://nodejs.org/en/download/releases/
image: node:15
stages:
- deploy
# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
paths:
- node_modules/
before_script:
- npm --version
- node --version
- npm install hexo-cli -g
- npm install
pages:
stage: deploy
script:
- hexo generate
artifacts:
paths:
- public
only:
- master
$ npm --version
7.7.6
$ node --version
v15.14.0
I were meeted the same issue that when darkmode
parameter setting true
not work . And then found other site dark style design were used the html DOM with attribute data-theme
and set it in CSS file theme work more powerful. See the below example:
main.css
[data-theme=dark] body {
background: #282828;
}
index.html
<html lang="en" data-theme="dark">
....
</html>
So that suggest use this way to instead of the @media(prefers-color-scheme: dark)
which more better compatibility.
Issue Checklist
Expected behavior
Darkmode working
Actual behavior
I have installed the last version of Next available via npm 8.7.0, installed a default website with
hexo init
, switeched to next theme, and just enabled dark mode but it's not working.I have tried with all 4 schemes, disabled the next cache, ran
hexo clean
, emptied the browser cache, tried with both firefox and chromium, the website never get black.It is reproducible 100% of the time with a minimal setup.
Steps to reproduce the behavior
hexo init darkmode_not_working && cd darkmode_not_working
npm install hexo-theme-next --save
cp node_modules/hexo-theme-next/_config.yml _config.next.yml
theme: next
in_config.yml
darkmode: true
in_config.next.yml
hexo g && hexo s
Environment Information
Node.js and NPM Information
Package dependencies Information
Hexo Configuration
The default, just changed
theme: next
.NexT Configuration
Other Information