shanexu / auto-dark-emacs

Auto-Dark-Emacs is an auto changer between 2 themes, dark/light, following MacOS Dark Mode settings

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auto-Dark for Emacs

MELPA

Do you want Emacs to follow your MacOS/Linux/Windows Dark-mode on/off options?

This is it. This program lets Emacs change between 2 user defined (customizable) themes to be automatically changed when Dark Mode set on/off on MacOS/Linux/Windows. Now only supports Gnome on Linux.

By default, themes are wombat and leuven, since these are bundled with Emacs.

Install

Install it from MELPA and add to your .emacs file:

(require 'auto-dark)
(auto-dark-mode t)

Or simply copy the auto-dark.el file to ~/.emacs.d/auto-dark/auto-dark.el (or clone this repository there), and then add the following to your .emacs:

(add-to-list 'load-path "~/.emacs.d/auto-dark/")
(require 'auto-dark)
(auto-dark-mode t)

Or use use-package to install:

(use-package auto-dark
  :config (auto-dark-mode t))

Spacemacs

If you use Spacemacs, add (auto-dark) to the dotspacemacs-additional-packages list and add the following to dotspacemacs/user-config:

(use-package auto-dark
  :init (spacemacs/defer-until-after-user-config (lambda () (auto-dark-mode t)))
  :defer t)

This ensures that auto-dark-mode is activated only after spacemacs's built-in theme loading logic.

Usage

Change your dark-mode settings on MacOS/Linux/Windows and let the magic happens :D

Customization

The light/dark themes can be customized using the Emacs customization system. M-x customize-group auto-dark.

OSA Script fallback

For terminal-based emacs, it is possible to check dark mode status using osascript rather than relying on the built-in Applescript support that GUI Emacs provides. To enable it, customize dark-mode-allow-osascript and set it to t.

Screenshot

A demo of this package in action.

auto-dark-emacs in acition full screen

About

Auto-Dark-Emacs is an auto changer between 2 themes, dark/light, following MacOS Dark Mode settings

License:GNU General Public License v2.0


Languages

Language:Emacs Lisp 100.0%