Skip to content
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

support color-scheme #1430

Open
akellbl4 opened this issue Jul 22, 2022 · 2 comments
Open

support color-scheme #1430

akellbl4 opened this issue Jul 22, 2022 · 2 comments

Comments

@akellbl4
Copy link
Collaborator

akellbl4 commented Jul 22, 2022

  • add new option for theme to the config in order to understand if site supports auto switch between light and dart theme
  • add color-scheme: light dark when the param is true, add light or dark when false and switch coloe-scheme value accordingly
  • remove this change disable color-scheme on remark iframe #1429

Cases

Auto

var remark_config = {
  theme: 'auto'
}
color-scheme: light dark;

Add support for auto switch between themes

Dark

var remark_config = {
  theme: 'dark'
}
color-scheme: dark;

Light

var remark_config = {
  theme: 'light'
}
color-scheme: light;
@OnkelTem
Copy link

Sorry, so can it be fixed? Because the related issue was closed unresolved: #1662

Currently I see this:

image

@hndrk-themer
Copy link

hndrk-themer commented Aug 10, 2024

as a workaround, i have added the autoswitch by using:

theme: window.matchMedia && window.matchMedia('(prefers-color-scheme:dark)').matches ? "dark" : "light",

to let it change automatically if you switch from light to dark without reloading the page i've added:

window.matchMedia('(prefers-color-scheme:dark)').addEventListener('change', event => {
        const newColorScheme = event.matches ? "dark" : "light";
        window.REMARK42.changeTheme(newColorScheme);
    }); 

to it. maybe you can add it directly into remark with the "auto" tag

it works perfectly like this on my blog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants