lambdalisue/vim-chameleon

Support Linux

Open

#2 opened on 2024年11月19日

GitHub で見る
 (0 comments) (0 reactions) (0 assignees)TypeScript (0 forks)github user discovery
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-scheme

Output:

  • '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 dark

Option 2: Check the color scheme

grep "color-scheme" ~/.config/kdeglobals

Output:

  • 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/ThemeName

Output:

  • If the theme name contains "dark," dark mode is likely enabled.

General Method for GTK Applications

GTK applications respect the gtk-application-prefer-dark-theme setting. To check the theme, use:

Option 1: Check the GTK theme

gsettings get org.gnome.desktop.interface gtk-theme

Option 2: Check the environment variable

echo $GTK_THEME

Output:

  • A theme name containing "dark" indicates dark mode is enabled.

Summary of Commands

Desktop Environment Command
GNOME gsettings get org.gnome.desktop.interface color-scheme
KDE Plasma grep "Name" ~/.config/kdeglobals | grep -i dark
XFCE xfconf-query -c xsettings -p /Net/ThemeName
General GTK gsettings get org.gnome.desktop.interface gtk-theme or $GTK_THEME

コントリビューターガイド