Git Product home page Git Product logo

auto-dark-emacs's Introduction

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. For now it supports Linux through Gnome and Termux(Android).

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.

Doom Emacs

If you use Doom Emacs, the following config should do the trick

;; In your packages.el
(package! auto-dark)

;; In your config.el

(after! doom-themes
  ;; set  your favorite themes
  (setq! auto-dark-dark-theme 'doom-one
        auto-dark-light-theme 'doom-one-light)
  (auto-dark-mode 1))

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.

You can also take advantage of the hooks auto-dark-dark-mode-hook and auto-dark-light-mode-hook to make it even further customizable. Take a look at this article on how to Integrate Catppuccin with Auto-Dark.

OSA Script fallback (macOS)

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

This package in action:

  • macOS

auto-dark-emacs in action - macos

  • Linux (Gnome DE)

auto-dark-emacs in action - linux gnome

auto-dark-emacs's People

Contributors

lionyxml avatar j3rn avatar seagle0128 avatar smallzhan avatar ianhattendorf avatar illia-danko avatar paquiteau avatar syohex avatar timcharper avatar real-or-random avatar muyinliu avatar realcomplex avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.