-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Adapt dark mode based on system settings #12276
Comments
@MariusBluem I've indeed seen a doc passed by last week. |
Not that hard: https://developer.apple.com/safari/technology-preview/ 😉 |
Looks like this needs to wait for 17. |
Heise.de just reported (unfortunately only in German) that Apple asks website administrators to support the new function. Since end of April a first editors draft CSS specification "CSS Color Adjust Module Level 1" exists which describes this feature. |
I just found that Safari, Chrome and Firefox already seem to support that: |
I like the day/night switch :) Shall we do this for 18? |
@skjnldsv wouldn't it be possible to @import via css depending on the switch the right css-file? So one would be able to keep the css files separate instead of loading both always. Of course this would be a separate request and one had to check whether this costs more time than loading one big file or not. |
@stefan-niedermann I thought about it, but it doesn't really matter :) |
As far as I understand it #21366 is only for guest access and doesn’t implement this feature for authenticated users. Should we actually keep the issue open for this reason? |
Yeah the autoclose was not intended, see comments on the PR |
https://caniuse.com/#search=prefers-color-scheme |
As a quick workaround, I added this to
This inverts everything, but then rotates the hue half around so that e.g. red stays red(ish), but black goes white and white goes black. Then, images are inverted back and again hue-rotated, so that they keep their original appearance. |
This would make the pages barely usable for lots of apps. |
Well if you want a workaround replace: server/apps/accessibility/lib/AppInfo/Application.php Lines 55 to 73 in 2916402
with: public function injectCss() {
$userValues = ['dark'];
$hash = md5(implode('-', $userValues));
$linkToCSS = $this->urlGenerator->linkToRoute(self::APP_NAME . '.accessibility.getCss', ['md5' => $hash]);
\OCP\Util::addHeader('link', ['rel' => 'stylesheet', 'media' => '(prefers-color-scheme: dark)', 'href' => $linkToCSS]);
} then no matter what you select in the settings, the browsers system preference will be used. |
@skjnldsv: True, that's why I called it a "workaround". @nickvergessen: sounds fairly easy. Is there a way to implement that without screwing everything up and losing it on the next update? |
No, because that ignores the users preference set in the settings. |
Since we can only do things in CSS here a possible solution would be the following:
|
Could you please explain, what makes this so complicated? What about this approach:
Extended approaches would include CSS variables where there is a default theme and the Just curious… |
I am confused. For public pages, the dark mode is already supported. So it should be possible to adopt this for internal pages as well. Thought too easy? |
The difference is that logged in users have a setting which should overrule the preference as far as I understand. |
The dark mode could clash with the themes, but the optimal way would be to let the user chose, which setting he prefers:
Aditionally, the dark theme could be deprecated or removed then. |
macOS Mojave is supporting dark mode and the Safari Technology Preview 68 is supporting automatically setting dark mode for homepages if set in system-settings. This seems to be handled via CSS
prefers-color-scheme
media query. Is it easy to support this? 🤔Ref.: https://trac.webkit.org/changeset/237156/webkit
@skjnldsv @nextcloud/designers
The text was updated successfully, but these errors were encountered: