As CSS and JS it should be possible to use this either as a gadget only (no install) or as a user script and css, but how? Tye js needs modifying to do this.
Extension talk:DarkMode
You can set it up like it's done on English Wikipedia. See w:Wikipedia:Dark mode (gadget) for instructions.
There seems to be quite a bit of divergence between the gadget and the extension. Maybe something can be done to sync them?
- The gadget CSS has received a bunch of edits, some requested after MusikAnimal's last edit: https://en.wikipedia.org/w/index.php?title=MediaWiki%3AGadget-dark-mode.css&diff=1172905668&oldid=1101625928
- The extension CSS has got 6 new commits in 2023
- The gadget JS is, well, a lot less functional than the extension thing which has an icon, but I suppose whether to change it would require a discussion
I found the images or elements with mw-no-invert
class are still slightly color-altered. I looked into it and found the two hue-rotate(180deg)
did not exactly return to the original color. invert()
does not influence this.
"filter: unset" should return it to normal. Definitely should be a configuration option though.
filter: unset
equals to filter: none
. It does not remove filters applied by parent elements.
Apologies; I meant to apply "filter: unset" on the root element where the original filter is set. Then you can implement your own class (.client-darkmode .invertible) on elements you want to invert - if you were wanting any to be inverted in the first place.
I ended up just ditching the built-in resources/ext.DarkMode.less file altogether and making my own for that very reason, but also to maintain more control (example).
I installed it to extensions and added the following in LocalSettings.php
wfLoadExtension( 'DarkMode' );
The Darkmode shows up but when I click it all it does is adds a # to the end of the url.
It also does not change to Default
Thanks.
What MediaWiki version, browser, and skin are you using? It sounds like a JavaScript error. See w:WP:JSERROR on how to report those.
Mediawiki 1.39.1
Firefox 112.0.2 (64-bit)
vector
The resource from “<url that it won't let me post>/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff)
Thanks
Hi,
I try today this extension and non-logged users have to toggle in dark mode at each page. Is there a fix to that problem ?
Regards
Please see Topic:Wpakcrc34z4v9qmc; a cookie might memorize the last used preference, for both registered and anonymous users.
Hi,
in darkmode, the logo of the wiki is in negative photo mode. How can I fix this ?
Regards
This extension does not work on mobile sites.
To be more specific, first of all, there is no button to enable or disable dark mode on the mobile site, and even if you log in with the same account and turn it on on the desktop site, it will not apply to mobile.
Can confirm. Does not work on mobile. Disappointing.
Hi, I was using the DarkMode extension recently and I am not really sure why the two bottom corners always remain white.
(for more context: if a page is longer and you have to scroll, the left and right sides cut from dark to white at some point)
I searched everywhere but didn't find anything documenting this.
Installed software
Product | Version |
---|---|
MediaWiki | 1.39.0 |
PHP | 8.1.8 (fpm-fcgi) |
MariaDB | 10.7.7-MariaDB |
ICU | 67.1 |
Lua | 5.1.5 |
Pygments | 2.11.2 |
Extension | Version | License | Description | Authors |
---|---|---|---|---|
DarkMode | 0.2.0 (2c6c85b) 21:21, 5 December 2022 | MIT | A toggleable dark mode for the MediaWiki user interface | MusikAnimal and R4356th |
I can see the same behaviour on example wiki at https://meta.miraheze.org/wiki/Miraheze when toggling on dark mode.
Thanks
Sorry to bring this up but I am also having this same problem on my wiki and I have not found a solution to the problem, I am still having this problem.
It wasn't obvious at first but nl6720 posted the fix here
You have to add the following code here to your MediaWiki:Common.css
/* Work around a bug in Extension:DarkMode where it sets the background color to
* black and then inverts it.
*/
@media screen {
html.client-darkmode {
/* body-background-color from https://github.com/archlinux/archwiki/blob/master/extensions/ArchLinux/modules/arch_definitions.less */
background-color: #f6f9fc;
}
}
It would be nice if Dark Mode were not applied to the "Printable version". Is there a built in option for that?
Hi, when I navigate to my mediawiki installation, I can see the Darkmode toggle but I have to click it to change to dark mode. If I log out, the wiki changes back to light mode. Is there any way to always make Darkmode the default logged in or out? Thank you.
Basically yes.
Developers might create a cookie which is bound to browser profile and would memorize last state until cookies are deleted or browser account or device is changed or preference is explicitly set again.
It would be nice if DarkMode had a toggle to *not* invert anything by default, just provide the switch and the HTML-level class to be able to make ".client-dark-mode" CSS rules. Un-inverting images with another filter does not always bring it back to the correct colors exactly and it's tricky to get the exact background colors you want via CSS since it's all being inverted.
It appears just doing "filter: unset" on `.client-dark-mode` does just that. Would be lighter to have an extension variable control that though.