-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Content outside markdown-style doesn't adapt to dark/light mode changes #69
Comments
@Regenhardt Follow the system to switch between light and dark themes? |
Yes the operating system or browser. If the browser is set to follow the OS, the website gets the theme change event when the device (I tried Windows and Android) changes theme. The markdown-style element hooks listens to the, the rest does not. |
I'd try to do that myself but I don't understand how those html strings in the ts files work, they look jumbled already. |
$ markdown-to-html-cli --dark-mode auto
$ markdown-to-html-cli --dark-mode auto --markdown-style-theme dark
$ markdown-to-html-cli --no-dark-mode --markdown-style-theme dark
$ markdown-to-html-cli --markdown-style-theme dark - name: Converts Markdown to HTML
uses: jaywcjlove/markdown-to-html-cli@main
with:
source: README-zh.md
output: coverage/action.html
dark-mode: auto
markdown-style-theme: dark
markdown-style: "max-width: 1260px"
github-corners: https://github.com/jaywcjlove/markdown-to-html-cli |
$ markdown-to-html-cli --dark-mode auto --markdown-style-theme light --no-corners @Regenhardt I used the above command to generate the page and found no problems. |
Ok so I did some tests and apparently this only happens when called from my custom domain (https://regenhardt.dev), but it works fine when called directly (https://regenhardt.gitlab.io). Any idea how that is possible? The custom domain literally routes to the same server as the gitlab.io domain. |
@Regenhardt Both pages work fine on my computer. I guess it might be a browser cache issue. |
Even without caching this happens. But I found out so far it only happens if I use the custom domain and only in Firefox. Do you have an idea what else I could check or try? I'm not sure where to go from here since the permanent attribute seems to come from some js/ts code somewhere, which is jumbled to me. |
|
Ok I found it: Firefox still had the theme saved in local storage, so I guess that triggered part of the website keeping the theme even after reloading with clear cache. After emptying local storage for the custom domain, it now also automatically changes as a whole. Thanks for the help! |
When the system changes from light mode to dark mode, the markdown-style element correctly switches style too.
The body itself though does not. Neither does the dark mode switch, nor the github corner (although the github corner still kinda works in dark mode like this).
I see the dark mode switcher already switches CSS variables on the body and those are used in the markdown-style element, so maybe the dark mode switcher could hook into the system event to trigger the same function there, switching everything between modes, then the markdown-style element doesn't need the hook itself (unless there's other CSS in there I haven't seen, I'm not a web dev😅).
The text was updated successfully, but these errors were encountered: