;;; theme-day.el --- switch themes based on time of day and mode. -*- lexical-binding: t; -*- ;; Copyright (C) 2022 Gabriel Simmer ;; Author: Gabriel Simmer ;; Keywords: themes, utility ;; Version: 0.0.1 ;;; Commentary: ;; This package provides a quick way of switching between predefined themes ;; with a simple toggle. Future versions may include a way of doing so automatically ;; at certain times of the day. ;;; Code: (require 'cl-lib) (defvar theme-day-keep-enabled '() "List of themes to keep enabled when toggling") (defconst theme-day-light 'modus-operandi "The theme to use during the day - preferably something lighter") (defconst theme-day-night 'modus-vivendi "The theme to use at night - preferably something dark") (defvar theme-day-current-theme theme-day-light) (defun swap-theme (new &optional keep) "Swaps out enabled theme(s) for new, keeping any specified" (setq enabled-themes (cl-intersection keep custom-enabled-themes)) (push new enabled-themes) (customize-set-variable 'custom-enabled-themes enabled-themes)) (defun theme-day-toggle () (if (eq theme-day-current-theme theme-day-light) (progn (theme-day-swap theme-day-night) (setq theme-day-current-theme theme-day-night)) (progn (theme-day-swap theme-day-light) (setq theme-day-current-theme theme-day-light)))) (defun theme-day-swap (theme) "Trigger theme swap" (swap-theme theme theme-day-keep-enabled)) (defun theme-day () (interactive) (theme-day-toggle)) (provide 'theme-day) ;;; theme-day.el ends here