From 0e876e09e80ec2476bc94ce3119df6b601d01f2e Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sat, 24 Aug 2024 18:51:00 +0100 Subject: (Emacs/config|elisp)+custom light theme with switches in config.org --- Emacs/.config/emacs/config.org | 58 ++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 28 deletions(-) (limited to 'Emacs/.config/emacs/config.org') diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index 91a5338..7701068 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -234,52 +234,54 @@ do that for me. General look and feel of Emacs (mostly disabling stuff I don't like). ** Themes I have both a dark and light theme for differing situations. -*** Dark theme +Here I configure which one to load and how to switch between them. + My preferred dark theme is my own "personal-solarized" theme which is stored in the Emacs lisp folder (look at [[file:elisp/personal-solarized-theme.el][this file]]). It's essentially a copy of the solarized theme (from the ~solarized-themes~ package) with a few personal changes. +My preferred light theme is modus-operandi, mostly because I don't +care to design my own light theme and I rarely use them. They are +necessary in high light situations where a dark mode would strain the +eyes too much. + #+begin_src emacs-lisp (use-package custom + :defer t + :commands +oreo/switch-theme :init (setq custom-theme-directory (concat user-emacs-directory "elisp/")) + (defvar +oreo/theme-list `(personal-light personal-solarized)) + (defvar +oreo/theme 1) :config - (load-theme 'personal-solarized t)) -#+end_src -*** Switching between light and dark -I'm not very good at designing light themes as I don't really use -them. However they are necessary in high light situations where a -dark mode would strain the eyes too much. So I built a custom theme -on top of the default Emacs theme, "personal-light". -2024-06-11: I now use modus-operandi for my light theme. + (defun +oreo/disable-other-themes () + "Disable all other themes in +OREO/THEME-LIST excluding ++OREO/THEME." + (cl-loop + for theme in +oreo/theme-list + for i from 0 + if (not (= i +oreo/theme)) + do (disable-theme theme))) -I don't use it by default but I may need to switch between light and -dark easily, so here's a command to switch between them. + (defun +oreo/load-theme () + "Load +OREO/THEME, disabling all other themes to reduce conflict." + (mapc #'disable-theme custom-enabled-themes) + (+oreo/disable-other-themes) + (load-theme (nth +oreo/theme +oreo/theme-list) t)) -#+begin_src emacs-lisp -(use-package custom - :defer t - :commands +oreo/switch-theme - :init - (defvar +oreo/theme 'dark) - :config (defun +oreo/switch-theme () + "Flip between different themes set in +OREO/THEME-ALIST." (interactive) - (cl-case +oreo/theme - (dark - (mapc #'disable-theme custom-enabled-themes) - (load-theme 'modus-operandi t) - (setq +oreo/theme 'light)) - (light - (mapc #'disable-theme custom-enabled-themes) - (load-theme 'personal-solarized t) - (setq +oreo/theme 'dark))))) + (setq +oreo/theme (mod (+ 1 +oreo/theme) (length +oreo/theme-list))) + (+oreo/load-theme)) + + (+oreo/load-theme)) #+end_src ** Font size -Make font size bigger on my laptop and smaller on my desktop. +Adjust font sizes for my devices. #+begin_src emacs-lisp (use-package faces -- cgit v1.2.3-13-gbd6f