{"id":16662856,"url":"https://github.com/lionyxml/auto-dark-emacs","last_synced_at":"2025-10-09T03:15:04.149Z","repository":{"id":40507006,"uuid":"197285970","full_name":"LionyxML/auto-dark-emacs","owner":"LionyxML","description":"Auto-Dark-Emacs is an auto changer between 2 themes, dark/light, following MacOS, Linux or Windows Dark Mode settings","archived":false,"fork":false,"pushed_at":"2025-10-06T04:03:45.000Z","size":5219,"stargazers_count":214,"open_issues_count":13,"forks_count":37,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-06T05:45:19.730Z","etag":null,"topics":["automation","emacs","theme"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LionyxML.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-07-17T00:28:47.000Z","updated_at":"2025-10-06T04:00:49.000Z","dependencies_parsed_at":"2025-05-17T22:06:48.745Z","dependency_job_id":"39db718c-f6fb-48f9-a0d0-b630fc2d44df","html_url":"https://github.com/LionyxML/auto-dark-emacs","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/LionyxML/auto-dark-emacs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LionyxML%2Fauto-dark-emacs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LionyxML%2Fauto-dark-emacs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LionyxML%2Fauto-dark-emacs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LionyxML%2Fauto-dark-emacs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LionyxML","download_url":"https://codeload.github.com/LionyxML/auto-dark-emacs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LionyxML%2Fauto-dark-emacs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000773,"owners_count":26082911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","emacs","theme"],"created_at":"2024-10-12T10:39:06.561Z","updated_at":"2025-10-09T03:15:04.143Z","avatar_url":"https://github.com/LionyxML.png","language":"Emacs Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auto-Dark for Emacs\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/auto-dark-logo.png\" alt=\"Auto-Dark Project Logo\" width=\"300\"/\u003e\n\u003c/p\u003e\n\n\u003ctable align=\"center\"\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\n      \u003ca href=\"https://www.gnu.org/software/emacs/emacs.html\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/GNU-Emacs-green.svg\" alt=\"Emacs\"/\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n      \u003ca href=\"https://www.gnu.org/licenses/gpl-3.0.en.html\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-GPLv3-blue.svg\" alt=\"GPLv3 License\"/\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n      \u003ca href=\"https://melpa.org/#/auto-dark\"\u003e\n        \u003cimg src=\"https://melpa.org/packages/auto-dark-badge.svg\" alt=\"MELPA badge\"/\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n      \u003ca href=\"https://stable.melpa.org/#/auto-dark\"\u003e\n        \u003cimg src=\"https://stable.melpa.org/packages/auto-dark-badge.svg\" alt=\"MELPA Stable badge\"/\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003ctable align=\"center\"\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\n      \u003ch5\u003eDev: \u003ca href=\"https://garnix.io/repo/LionyxML/auto-dark-emacs?branch=development\"\u003e\n      \u003cimg src=\"https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgarnix.io%2Fapi%2Fbadges%2FLionyxML%2Fauto-dark-emacs%3Fbranch%3Ddevelopment\" alt=\"Garnix Dev build\"/\u003e\n      \u003c/a\u003e\n      \u003c/h5\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n      \u003ch5\u003eProd: \u003ca href=\"https://garnix.io/repo/LionyxML/auto-dark-emacs\"\u003e\n      \u003cimg src=\"https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgarnix.io%2Fapi%2Fbadges%2FLionyxML%2Fauto-dark-emacs\" alt=\"Garnix Master build\"/\u003e\n      \u003c/a\u003e\n      \u003c/h5\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003cp align=\"center\"\u003e\n  Want Emacs to automatically follow your system’s dark mode on macOS, Linux, Windows, or even Android?\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#installation\"\u003e\u003cstrong\u003eInstallation\u003c/strong\u003e\u003c/a\u003e ·\n  \u003ca href=\"#settings\"\u003e\u003cstrong\u003eSettings\u003c/strong\u003e\u003c/a\u003e ·\n  \u003ca href=\"#screenshots\"\u003e\u003cstrong\u003eScreenshots\u003c/strong\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003chr /\u003e\n\nThis package, `auto-dark-mode`, introduces a minor mode in Emacs that\nenables automatic switching between two user-defined (customizable)\nthemes. This transition occurs seamlessly in response to Dark Mode\nbeing enabled or disabled across MacOS, Linux, Windows, and Android\nplatforms.\n\nFor now it supports Linux through `dbus` and Android via `Termux`.\n\n## Installation\n\n### Regular Emacs\n\nInstall it from [MELPA](https://melpa.org/#/auto-dark) and add to your\n`.emacs` or `init.el` file:\n\n```emacs-lisp\n(require 'auto-dark)\n(auto-dark-mode)\n```\n\nOr simply copy the `auto-dark.el` file to\n`~/.emacs.d/auto-dark/auto-dark.el` (or clone this repository there),\nand then add the following to your `.emacs`:\n\n```emacs-lisp\n(add-to-list 'load-path \"~/.emacs.d/auto-dark/\")\n(require 'auto-dark)\n(auto-dark-mode)\n```\n\nOr use `use-package` to install:\n\n```emacs-lisp\n(use-package auto-dark\n  :init (auto-dark-mode))\n```\n\n### Spacemacs\n\nIf you use Spacemacs, add `(auto-dark)` to the\n`dotspacemacs-additional-packages` list and add the following to\n`dotspacemacs/user-config`:\n\n```emacs-lisp\n(use-package auto-dark\n  :init (spacemacs/defer-until-after-user-config #'auto-dark-mode)\n  :defer t)\n```\n\nThis ensures that `auto-dark-mode` is activated only after spacemacs's\nbuilt-in theme loading logic.\n\n### Doom Emacs\n\nIf you use Doom Emacs, load the package in your `packages.el`:\n\n```emacs-lisp\n;; In your packages.el\n(package! auto-dark)\n```\n\nAnd put the following snippet in your `config.el`:\n\n```emacs-lisp\n(use-package! auto-dark\n  :defer t\n  :init\n  ;; Configure themes\n  (setq! auto-dark-themes '((doom-solarized-dark) (doom-solarized-light)))\n  ;; Disable doom's theme loading mechanism (just to make sure)\n  (setq! doom-theme nil)\n  ;; Declare that all themes are safe to load.\n  ;; Be aware that setting this variable may have security implications if you\n  ;; get tricked into loading untrusted themes (via auto-dark-mode or manually).\n  ;; See the documentation of custom-safe-themes for details.\n  (setq! custom-safe-themes t)\n  ;; Enable auto-dark-mode at the right point in time.\n  ;; This is inspired by doom-ui.el. Using server-after-make-frame-hook avoids\n  ;; issues with an early start of the emacs daemon using systemd, which causes\n  ;; problems with the DBus connection that auto-dark mode relies upon.\n  (defun my-auto-dark-init-h ()\n    (auto-dark-mode)\n    (remove-hook 'server-after-make-frame-hook #'my-auto-dark-init-h)\n    (remove-hook 'after-init-hook #'my-auto-dark-init-h))\n  (let ((hook (if (daemonp)\n                  'server-after-make-frame-hook\n                'after-init-hook)))\n    ;; Depth -95 puts this before doom-init-theme-h, which sounds like a good\n    ;; idea, if only for performance reasons.\n    (add-hook hook #'my-auto-dark-init-h -95)))\n```\n\n## Notes for MacOS users\n\nFrom the box, this package takes advantage of some built-in functionality found\non the formulaes [Emacs Plus](https://github.com/d12frosted/homebrew-emacs-plus)\nand [Emacs Mac](https://github.com/railwaycat/homebrew-emacsmacport?tab=readme-ov-file)\nto make detecting switches faster.\n\nIf you compiled Emacs yourself or used any other pre-compiled binary,\nit is essential to explicitly instruct `auto-dark` you want to use\n`Osascript`.\n\nYou can do this by adding to your configuration:\n\n```emacs-lisp\n(setq auto-dark-allow-osascript t)\n```\n\nDoing so will probably make MacOS prompt you for security permissions.\nIf by any chance it does not prompt you, you can check permissions on MacOS\nby going to:\n\n```\nSettings -\u003e Privacy \u0026 Security -\u003e Emacs -\u003e System Events\n```\n\nAlso notice if you run emacs from the terminal, `Osascript` is the only method that\nwill work.\n\n## Notes for Emacs Daemon / Server Mode Users\n\nIf you start Emacs as a daemon (`emacs --daemon`), `auto-dark-mode` may not\ncorrectly detect the system theme when the first GUI frame is created. This is\nbecause the theme detection runs before the first frame is available.\n\nTo fix this, you can add a hook to run `auto-dark-mode` after the first frame\nis created:\n\n```emacs-lisp\n(defun my/server-auto-dark (frame)\n  (with-selected-frame frame\n    (when (display-graphic-p)\n      (auto-dark-mode 1)\n      ;; Remove hook so it only runs once\n      (remove-hook 'after-make-frame-functions #'my/server-auto-dark))))\n\n(use-package auto-dark\n  :config\n  (setq auto-dark-themes '((modus-operandi) (modus-vivendi)))\n  (add-hook 'after-make-frame-functions #'my/server-auto-dark))\n```\n\nAlso, take a look at #32 and #71 issues.\n\n## Settings\n\nAll provided options, including The light/dark themes can be\ncustomized using the Emacs customization system. `M-x customize-group auto-dark RET`.\n\nYou can also take advantage of the hooks `auto-dark-dark-mode-hook`\nand `auto-dark-light-mode-hook` to make it even further\ncustomizable. Take a look at this article on how to [Integrate\nCatppuccin with\nAuto-Dark](https://www.rahuljuliato.com/posts/auto-dark-catppuccin).\n\nFollowing, a complete configuration with all settings set to its defaults:\n\n```emacs-lisp\n(use-package auto-dark\n  :ensure t\n  :custom\n  (auto-dark-themes '((wombat) (leuven)))\n  (auto-dark-polling-interval-seconds 5)\n  (auto-dark-allow-osascript nil)\n  (auto-dark-allow-powershell nil)\n  ;; (auto-dark-detection-method nil) ;; dangerous to be set manually\n  :hook\n  (auto-dark-dark-mode\n   . (lambda ()\n        ;; something to execute when dark mode is detected\n        ))\n  (auto-dark-light-mode\n   . (lambda ()\n        ;; something to execute when light mode is detected\n        ))\n  :init (auto-dark-mode))\n```\n\nA short description of each setting:\n\n#### `auto-dark-themes`\n\nA list containing two elements. The first is the list of themes to enable when\ndark-mode is active and the second is the list of themes to enable when\ndark-mode is inactive.\n\nPossible values for each sublist are themes installed on your system found by\n`customize-themes` or `nil` to use Emacs with no themes (default appearance).\n\nIf this variable is `nil`, then the set of themes from `custom-enabled-themes`\nwill be used for both dark and light mode. These themes must support\n`frame-background-mode`, or else there will be no visible change.\n\n**NB**: When adding themes to this list, switching between light and dark, or\ninitializing Emacs, you may see a prompt like “Loading a theme can run Lisp\ncode. Really load?” If you answer “yes” and allow Emacs to treat the theme as\nsafe in future sessions, you should only see this prompt once per theme. To\ndisable the prompt completely, you can set `custom-safe-themes` to `t` before\nsetting `auto-dark-themes`.\n\n#### `auto-dark-polling-interval-seconds`\n\nThe number of seconds between which to poll for dark mode state.\nEmacs must be restarted for this value to take effect.\n\nThis is here for when there's no emacs-plus (MacOS), or emacs-mac\n(MacOS) or a system with dbus or capable of sending events is found, a\ntimed polling is called to check the current system status.\n\n#### `auto-dark-allow-osascript`\n\nWhether to allow function `auto-dark-mode` to shell out to osascript:\nto check dark-mode state, if `ns-do-applescript` or `mac-do-applescript`.\n\nThis is only useful for MacOS, please check the section `Notes for\nMacOS users` above.\n\n#### `auto-dark-allow-powershell`\n\nWhether to allow function `auto-dark-mode` to shell out to powershell:\nto check dark-mode state.\n\nThis is only useful for `Windows`. If not set, it will use the built-in Emacs\nWindows Registry functions.\n\n#### `auto-dark-dark-mode-hook`\n\nList of hooks to run after dark mode is loaded.\n\nYou can use this hook to take leverage of `auto-dark` detection system and\nissue more elisp code when some state is detected. You can even use **only** the\nhooks by setting the themes to `nil`.\n\n#### `auto-dark-light-mode-hook`\n\n\"List of hooks to run after light mode is loaded.\"\n\nYou can use this hook to take leverage of `auto-dark` detection system and\nissue more elisp code when some state is detected. You can even use **only** the\nhooks by setting the themes to `nil`.\n\n#### `auto-dark-detection-method`\n\nThe method auto-dark should use to detect the system theme.\n\nDefaults to nil and will be populated through feature detection\nif left as such. Only set this variable if you know what you're\ndoing!\n\n## Screenshots\n\nThis package in action:\n\n- macOS (emacs-plus formulae)\n\n![auto-dark-emacs in action - macos - emacs-plus](images/demo_emacs_plus.gif)\n\n- macOS (emacs-mac formulae)\n\n![auto-dark-emacs in action - macos - emacs-mac](images/demo_emacs_mac.gif)\n\n- Linux (Gnome DE)\n\n![auto-dark-emacs in action - linux gnome](images/demo_gnome.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flionyxml%2Fauto-dark-emacs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flionyxml%2Fauto-dark-emacs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flionyxml%2Fauto-dark-emacs/lists"}