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

Supports dark mode with color-scheme and prefers-color-scheme #1136

Open
automactic opened this issue May 24, 2020 · 4 comments
Open

Supports dark mode with color-scheme and prefers-color-scheme #1136

automactic opened this issue May 24, 2020 · 4 comments

Comments

@automactic
Copy link
Member

automactic commented May 24, 2020

Zim files are essentially bundles of html content, to support dark mode, one approach is to use CSS Color Schemes. While still in draft, it's already widely adopted. And I think this more standardized way of handling color scheme is better than rolling our own solution.

Step 1: let the browser know the page supports dark and light scheme:

:root {
  color-scheme: light dark;
}

or

<meta name="color-scheme" content="light dark">

Step 2: adjust existing css for specific color scheme

@media (prefers-color-scheme: dark) {
    xxxx
}

I know this step will take up a lot of time and energy, but in most of the situations, the user agent style sheet handles things pretty well.

Just by commenting out existing color and background-color css, I am able to make the page and plain text look nice on both light and dark scheme:
imgonline-com-ua-twotoone-brPmoRGm8PhHk0

@kelson42
Copy link
Collaborator

I really wonder why this is not handle properly like this upstream on Wikipedia.org.

@Jaifroid
Copy link
Collaborator

Isn't there a proposal for an API in ZIMs that might handle this kind of transform? Currently the different readers handle dark mode by injecting CSS stylesheets. By using an inversion stylesheet and re-inverting certain image type, it's fairly easy to come up with a "universal" (though not perfect) dark mode, and that could be the API. (It's what most of the current readers do.)

Otherwise handling dark mode as a set of themes is something that each Wiki would have to provide, as they would need to be tailored to the different styles used.

@stale
Copy link

stale bot commented Aug 14, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

@stale stale bot added the stale label Aug 14, 2020
@Lucent
Copy link

Lucent commented Sep 25, 2024

Related #2086

@stale stale bot removed the stale label Sep 25, 2024
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

4 participants