Bug 408563 - Provide option for day/night color theme switching
Summary: Provide option for day/night color theme switching
Status: CONFIRMED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_nightcolor (show other bugs)
Version: 5.17.0
Platform: Other Linux
: HI wishlist
Target Milestone: ---
Assignee: David Edmundson
URL: https://invent.kde.org/plasma/plasma-...
Keywords:
: 378528 411874 418721 430500 435894 447362 453962 481021 482454 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-06-11 12:26 UTC by Shriramana Sharma
Modified: 2024-03-10 00:07 UTC (History)
40 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shriramana Sharma 2019-06-11 12:26:46 UTC
Nowadays on mobile devices the ability to automatically switch between day and night themes based on sunrise/sunset or user-defined times is getting more prevalent.

For instance, https://twitter.com/TwitterDesign/status/1111317722543980544, Telegram.

I suggest that KDE Plasma can also provide the same on the desktop (and other platforms it works on).

Already at least in the following categories of the UI we have pairs of light/dark themes:

Desktop theme: Breeze Light/Dark
Cursor theme: Breeze Snow and Breeze
Application Color Scheme: Breeze and Breeze Dark, Solarized Light/Dark
Icons: Breeze and Breeze Dark

and IIANM if Katepart is set to use the KDE color scheme it will also automatically switch.
 
So what is being requested is a mechanism for the user to instruct the system to switch the above categories automatically to specified themes at specified times or based on sunrise/sunset for the current location which may be specified or automatically determined (like the Redshift plasmoid is able to do).
Comment 1 Nate Graham 2019-06-24 09:51:58 UTC
It might make sense to use the Night Color KCM for this. It already has a conception of day and night. If we make it aware of color schemes, we could add a new mode that switches color schemes instead of coloring the screen.
Comment 2 Nate Graham 2019-06-24 09:55:43 UTC
First we'd probably want to improve the visuals of the existing color switching mechanism. Right now there's no animation or transition; the colors just abruptly jump from one set to the other. When going from light to dark and vice versa, this is a little bit jarring. Adding a very fast animation between the states might be nice.
Comment 3 Filip Fila 2019-06-26 20:03:34 UTC
Agreed about adding it to the night color KCM and adding a transition.
Comment 4 Karl Ove Hufthammer 2019-11-08 18:46:00 UTC
*** Bug 411874 has been marked as a duplicate of this bug. ***
Comment 5 Nate Graham 2020-04-15 03:17:56 UTC
*** Bug 418721 has been marked as a duplicate of this bug. ***
Comment 6 Nate Graham 2020-06-12 16:21:31 UTC
*** Bug 378528 has been marked as a duplicate of this bug. ***
Comment 7 Claudius Ellsel 2020-06-12 16:44:19 UTC
(In reply to Nate Graham from comment #2)
> First we'd probably want to improve the visuals of the existing color
> switching mechanism. Right now there's no animation or transition; the
> colors just abruptly jump from one set to the other. When going from light
> to dark and vice versa, this is a little bit jarring. Adding a very fast
> animation between the states might be nice.

Also note that a gradually, almost unnoticeably slow animation has been suggested in https://bugs.kde.org/show_bug.cgi?id=378528

It might be hard to come up with nice transitions for all involved UI elements, though.
Comment 8 Nate Graham 2020-06-12 16:49:36 UTC
Adding an unnoticeably slow animation works for the full-screen tinting effect, but I'm not sure it would work for changing the color scheme. For example when you go form light to dark, the colors of the text and icons change from dark to light to preserve readability. If there was a very slow color change, then there would be a period of time in which both the window background and also the icons and text were gray, making them unreadable.
Comment 9 Claudius Ellsel 2020-06-12 16:58:04 UTC
I was thinking about the exact same problem. One would have to consider every UI element involved and decide whether applying a slow animation makes sense there (I think there are actually elements where a slow animation will look rather nice), how they work together and what problems might come with it. I guess currently that is just out of scope.
Comment 10 Nate Graham 2020-12-17 21:05:57 UTC
*** Bug 430500 has been marked as a duplicate of this bug. ***
Comment 11 Nate Graham 2021-04-21 20:13:30 UTC
*** Bug 435894 has been marked as a duplicate of this bug. ***
Comment 12 m11.1l1.f64 2021-11-22 19:57:21 UTC
Awesome!!

Honestly, I'm thinking something more than that. Actually something like a "Full Switch". Let me explain. When you change a plasma style,colors,application style or simply a global theme, and then you choose a dark theme, what happens? Most of kde applications (and a few others which depend on OS settings) switch to dark mode. But what about Gnome apps? Or okular? Those will not respect the global theme settings.

Also don't forget that dark mode is **NOT** just changing "Global Theme"! Sometimes, I just wanna change color scheme and that's all! A full-featured option panel can be created to set what a dark mode means to different users, and then depend on that settings, the theme would switch automatically.

Also the "Auto Night Mode" feature can have options like being based on Geo location(sunrise and sunset) a manual time, or sync with your phone through kde phone. Like when you turn on Dark mode on your phone, your desktop will also become dark!!

I know may or may not this relates to dark mode, but an option for making screen extra dim than the minimum brightness supported by your monitor (you can already do this trick with `xrandr --output [your output] --brightness [number between 0 to 1]`) for people who work at midnight.
Comment 13 tneo 2021-12-15 15:34:49 UTC
Can the KDE project make use of the work of https://github.com/daehruoydeef/Yin-Yang which does exactly do this, although not exactly tide to night-color time-schedule. The implementation done by Elementary OS could be used for KDE I think.
Comment 14 Nicolas Fella 2021-12-22 20:32:26 UTC
*** Bug 447362 has been marked as a duplicate of this bug. ***
Comment 15 Michele Perrone 2022-01-25 22:24:59 UTC
I think that this should be addressed. GNOME has this feature and it's quite convenient. For me, a simple switch between the Light/Dark theme at a time that coincides with Night Color would suffice. I wouldn't care if this switch was abrupt, that could be dealt with later.
Comment 16 Nate Graham 2022-05-18 15:28:31 UTC
*** Bug 453962 has been marked as a duplicate of this bug. ***
Comment 17 themroc 2022-11-10 08:48:50 UTC
I use this bash script in the startup to automatically change Breeze Light/Dark and the wallpaper.
It determines the sunrise and sunset for the site via the heliocron program:

#!/bin/bash

if ping -q -c 1 -W 1 8.8.8.8 >/dev/null; then
  longitude=$(curl ipinfo.io | jq -c ".loc" | tr -d '"' | awk -F',' '{print $1}')
  latitude=$(curl ipinfo.io | jq -c ".loc" | tr -d '"' | awk -F',' '{print $2}')
  if [ ! -f "/home/user/.location" ]; then
    echo "$longitude $latitude" > /home/user/.location
  else
    read -r longialt latialt < /home/user/.location
    if [ 1 != $(awk -v a="$latialt" -v b="$latitude" 'BEGIN{print(a==b)}') ] || [ 1 != $(awk -v a="$longialt" -v b="$longitude" 'BEGIN{print(a==b)}') ]; then
      cat /home/user/.location > /home/user/.locationalt
      echo "$longitude $latitude" > /home/user/.location
    fi
  fi
elif [ -f "/home/user/.location" ]; then
  read -r longitude latitude < /home/user/.location
else
  longitude=<defautlo>
  latitude=<defaultla>
fi

daystart=$(heliocron -l $longitude -o $latitude report | grep Sunrise | grep -o '[0-9][0-9]:[0-9][0-9]:[0-9][0-9]')
daystop=$(heliocron -l $longitude -o $latitude report | grep Sunset | grep -o '[0-9][0-9]:[0-9][0-9]:[0-9][0-9]')
currenttime=$(date +%H:%M:%S)
nextday=$(date --date="next day" +%F)
# thisday=$(date +%F)

if [[ "$currenttime" > "$daystart" ]] && [[ "$currenttime" < "$daystop" ]]; then
     lookandfeeltool -a org.kde.breeze.desktop
     plasma-apply-wallpaperimage /home/user/Bilder/Background/Taucher1920x1080.jpg
     heliocron -l $longitude -o $latitude wait -e sunset && lookandfeeltool -a org.kde.breezedark.desktop && plasma-apply-wallpaperimage /home/user/Bilder/Background/DarkestHour1920x1080.jpg
     sleep 2m
     heliocron -d $nextday -l $longitude -o $latitude wait -e sunrise && lookandfeeltool -a org.kde.breeze.desktop && plasma-apply-wallpaperimage /home/user/Bilder/Background/Taucher1920x1080.jpg
else
     lookandfeeltool -a org.kde.breezedark.desktop
     plasma-apply-wallpaperimage /home/user/Bilder/Background/DarkestHour1920x1080.jpg
     if [[ "$currenttime" > "$daystop" ]]; then
        heliocron -d $nextday -l $longitude -o $latitude wait -e sunrise && lookandfeeltool -a org.kde.breeze.desktop && plasma-apply-wallpaperimage /home/user/Bilder/Background/Taucher1920x1080.jpg
        sleep 2m
        heliocron -l $longitude -o $latitude wait -e sunset && lookandfeeltool -a org.kde.breezedark.desktop && plasma-apply-wallpaperimage /home/user/Bilder/Background/DarkestHour1920x1080.jpg
    else
        heliocron -l $longitude -o $latitude wait -e sunrise && lookandfeeltool -a org.kde.breeze.desktop && plasma-apply-wallpaperimage /home/user/Bilder/Background/Taucher1920x1080.jpg
        sleep 2m
        heliocron -l $longitude -o $latitude wait -e sunset && lookandfeeltool -a org.kde.breezedark.desktop && plasma-apply-wallpaperimage /home/user/Bilder/Background/DarkestHour1920x1080.jpg
    fi
fi
Comment 18 Gerion 2022-11-17 23:01:09 UTC
There seem to be some applications that provide exactly this setting:
https://github.com/baduhai/Koi
https://github.com/oskarsh/Yin-Yang
https://github.com/Professor-Paradox/KdeAutoThemeSwitch (seems to be inactive)

However, I would strongly prefer to have it in KDE directly. My hope is that, in this case, user applications can check the global theming and adapt itself automatically (browsers, color schemes in terminal emulators, ...).
Comment 19 Philipp A. 2023-05-01 11:47:08 UTC
This is being worked on: https://invent.kde.org/plasma/plasma-workspace/-/issues/59

Until then, here is two more options to do it: 

- https://gitlab.com/WhyNotHugo/darkman
- https://gitlab.com/LADlSLAV/yabotss (can be used with the former)
Comment 20 Nate Graham 2024-02-08 17:10:55 UTC
*** Bug 481021 has been marked as a duplicate of this bug. ***
Comment 21 Nate Graham 2024-03-05 21:28:18 UTC
*** Bug 482454 has been marked as a duplicate of this bug. ***