-
-
Notifications
You must be signed in to change notification settings - Fork 135
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
Implement a theming system (dark theme / night mode) #582
Conversation
Working in FFOS (screenshot), but not in IE11. IE10+ does not support CSS filters and never will. Ironically, IE9 did support an inversion filter, but it was buggy and dropped from IE10+. As this feature does not prevent core functionality in the app, I don't think it's crucial to support IE11 in this particular case. |
That looks cool. As you would expect, I'm against putting some ZIM-specific code in our Kiwix client, so I don't like the mwoffliner-specific CSS classes. Maybe a compromise would be to have 2 different "content themes" instead of a single one :
We would need to find the right wording in the Settings section (and in the code). So that, in the future, a user that kept this "temporary" theme in its preferences would understand he/she should try to switch to the generic one if there are visual issues (with future ZIM files). |
Thanks for that feedback, @mossroy . I completely agree with all your points, and it's very easy to add further custom themes - I'll have a think about the wording. It would actually work with popular Wikipedia-specific dark themes such as https://github.com/StylishThemes/Wikipedia-Dark - CSS source code too, but I think for our purposes what you suggest is good compromise. |
I've implemented these changes, with a pure theme ( |
No rush to review -- the code needs thorough field-testing, though I've done my usual checks in FFOS, Edge and Chromium, with Wikimedia, Stackexchange and Gutenberg ZIMs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not test, but here are some remarks on the code
Licence = noun (compare: advice) Lincense = verb (compare: advise) US spelling has generally forgotten this distniction!
I've tested on a Firefox OS device : an old platform issue seems to be back when you choose one of the two "Dark+invert" themes : the article content can not be scrolled any more (see #175). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I quickly tested, and it looks fine
Thanks @mossroy . I have noticed at a number of points when developing Kiwix JS Windows a similar issue to #175 on Windows Mobile, which seemed to do with with the OS sometimes sending touch only through to the top-level container -- in our case this would be Of course, the issue you notice could be simpler: the app freezes because of the extra cpu used in calculating colour inversions on all the elements in this case. Once I've merged this, I'll see if I can reproduce a set of conditions on another slow mobile, because it may be revealing something about the code or UI design. If I can reproduce something, I'll open a separate issue. |
This backports (but with much improved and generic coding) a dark theme as described in #265.
I have implemented this as a generic theming system, though only three themes are currently implemented:
light
(the current default);dark
(a theme for the app shell only); anddark_invert
(a theme for the app shell and the content in the iframe). The screenshots below shows thedark_invert
theme.The app shell themes do not touch the document loaded in the iframe. the content theme of course has to attach a stylesheet, using DOM methods, after the document has loaded. It works in both jQuey and Service Worker modes.
Inversion is carried out by adding a simple inversion filter to the iframe element (
articleContent
), but we have to attach a stylesheet to the iframe document to re-invert images and videos (generically) so that they do not look like photographic negatives. There are two non-generic rules that are specific to Wikimedia ZIMs (the vast majority). This is practically inevitable: for discussion see openzim/mwoffliner#1026 . If that proposal is implemented in the ZIM, it may be possible to remove one of the non-generic rules for future ZIMs. If a JS API is added to the ZIMs in the future, it will be possible to remove both non-generic rules.Image rendering
Configuration
Screenshot showing equations and search
Stackexchange