enhancementgood first issue
Repository metrics
- Stars
- (10 stars)
- PR merge metrics
- (PR metrics pending)
説明
It seems there are several way to detect that.
Detecting if an Application is in Dark Mode in Linux via CLI
GNOME Desktop Environment
To check the dark mode setting in GNOME, use the following command:
gsettings get org.gnome.desktop.interface color-schemeOutput:
'prefer-dark': Dark mode is enabled.''or'default': Default or light mode is enabled.
KDE Plasma Desktop Environment
To check if dark mode is enabled in KDE Plasma, use:
Option 1: Check the theme name
grep "Name" ~/.config/kdeglobals | grep -i darkOption 2: Check the color scheme
grep "color-scheme" ~/.config/kdeglobalsOutput:
- If a theme or color scheme contains "dark," dark mode is likely enabled.
XFCE Desktop Environment
To check the current GTK theme in XFCE, use:
xfconf-query -c xsettings -p /Net/ThemeNameOutput:
- If the theme name contains "dark," dark mode is likely enabled.
General Method for GTK Applications
GTK applications respect the
gtk-application-prefer-dark-themesetting. To check the theme, use:Option 1: Check the GTK theme
gsettings get org.gnome.desktop.interface gtk-themeOption 2: Check the environment variable
echo $GTK_THEMEOutput:
- A theme name containing "dark" indicates dark mode is enabled.
Summary of Commands
Desktop Environment Command GNOME gsettings get org.gnome.desktop.interface color-schemeKDE Plasma grep "Name" ~/.config/kdeglobals | grep -i darkXFCE xfconf-query -c xsettings -p /Net/ThemeNameGeneral GTK gsettings get org.gnome.desktop.interface gtk-themeor$GTK_THEME