-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Solved flickering bug for dark mode and added script to head #37
base: main
Are you sure you want to change the base?
Conversation
Thanks for the PR! It's great that the flickering stops with this fix. I think it's important that the dark-mode styles should be stored in a separate CSS file though and not hard-coded within the JavaScript. Users may wish to define different shades of grey and change the color different components for dark mode etc so I'm keen for this to load a CSS. Do you think you could adapt this PR to load a 'dark-mode' CSS file? |
I've amended the PR. |
This pull request introduces 1 alert when merging 2d00c89 into 00e0ed3 - view on LGTM.com new alerts:
|
heya @fredtux - thanks for the work on this PR. By adding However, I think users may choose to put the dark-mode CSS rules within their main style sheet - or they might have the CSS in the projects root or in a /css/ or /assets/css/ directory etc... but right now this PR requires the CSS to be called 'dark-mode.css' and be in the projects root. I think we should add the data attribute |
Hi! Sorry for the late response. |
Description
There was a flickering issue when dark mode was selected and the page was refreshed or opened.
I've added a function that creates a style element with the theme colors and can switch from lightmode to darkmode. I've used this as a source: StackOverflow
In order to fully resolve the flickering issue, the script must be included in the head element
Motivation and Context
Flickering issue described here: Github issue
How Has This Been Tested?
The changes can be tested by running index.html
Types of changes
Checklist: