From 855ebf9f43591e6800bc733cf2d71fcaf28d7e63 Mon Sep 17 00:00:00 2001 From: Benson Chu Date: Mon, 7 Sep 2020 17:17:35 -0500 Subject: [PATCH] Theming overhaul --- config-min.org | 84 +++++++++++++++++++++++++----- lisp/themes/dark-default-theme.el | 24 +++++++++ lisp/themes/light-default-theme.el | 50 ++++++++++++++++++ lisp/themes/same-defaults-theme.el | 61 ++++++++++++++++++++++ 4 files changed, 206 insertions(+), 13 deletions(-) create mode 100644 lisp/themes/light-default-theme.el create mode 100644 lisp/themes/same-defaults-theme.el diff --git a/config-min.org b/config-min.org index 548ee0d..e78b2a2 100644 --- a/config-min.org +++ b/config-min.org @@ -182,6 +182,7 @@ ;; gray for the background. This overrides those (add-to-list 'custom-theme-load-path "~/.emacs.d/lisp/themes") (load-theme 'dark-default) + (load-theme 'same-defaults) ;; Need to configure all-the-icons so that mode-line doesn't look fat ;; and ugly @@ -190,10 +191,6 @@ (set-face-attribute 'mode-line-inactive nil :height 100) (setq all-the-icons-scale-factor 1.0) - (set-face-attribute 'tab-bar nil :foreground "#70FF00" :background "dark slate gray" :inherit 'fixed-pitch) - (set-face-attribute 'tab-bar-tab nil :background "gray6") - (set-face-attribute 'tab-bar-tab-inactive nil :background "dark slate gray") - ;; The most efficient cool looking modeline I've ;; found. Faster than even smart-mode-line (use-package doom-modeline) @@ -209,15 +206,6 @@ (require 'display-hard-drive-space-mode) (display-hard-drive-space-mode) - ;; Roboto mono is nice - (when (member "Roboto Mono" (font-family-list)) - (set-face-attribute 'default nil :font "Roboto Mono" :height 100) - (set-face-attribute 'fixed-pitch nil :font "Roboto Mono" :height 100)) - - ;; (when (member "Liberation Serif" (font-family-list))) - (when (member "Linux Libertine" (font-family-list)) - (set-face-attribute 'variable-pitch nil :font "Linux Libertine" :height 130 - :width 'normal)) ;;(set-face-attribute 'variable-pitch nil :font '(:family "ETBookOT")) ;; I like my unicode to be monospace too, so I use these @@ -791,3 +779,73 @@ :config (setq-default olivetti-body-width 140)) #+end_src +** Change themes on the spot +#+begin_src emacs-lisp + (require 'light-default-theme) + (require 'dark-default-theme) + (use-package modus-operandi-theme) + + (defvar current-theme 'dark) + + (defvar light-theme 'modus-operandi) + (defvar dark-theme 'calm-forest) + + (defun switch-themes () + (interactive) + (setq current-theme (if (eq current-theme 'dark) 'light 'dark)) + (disable-theme 'same-defaults) + (pcase current-theme + ('light + (disable-theme 'dark-default) + (disable-theme dark-theme) + (enable-theme light-theme) + (enable-theme 'light-default)) + ('dark + (disable-theme 'light-default) + (disable-theme light-theme) + (enable-theme dark-theme) + (enable-theme 'dark-default))) + (enable-theme 'same-defaults) + (set-background-mode current-theme)) + + (defun reload-theme () + (interactive) + (disable-theme 'same-defaults) + (pcase current-theme + ('light + (disable-theme 'light-default) + (disable-theme light-theme) + (enable-theme light-theme) + (enable-theme 'light-default)) + ('dark + (disable-theme 'dark-default) + (disable-theme dark-theme) + (enable-theme dark-theme) + (enable-theme 'dark-default))) + (enable-theme 'same-defaults) + (set-background-mode current-theme)) + + (defun disable-all-theming () + (interactive) + (disable-theme 'light-default) + (disable-theme light-theme) + (disable-theme 'dark-default) + (disable-theme dark-theme) + (disable-theme 'same-defaults) + (set-background-mode 'light) + (setq default-theme 'light)) + + (ec/load-or-ask-pred 'my/light-default "Use light-theme? ") + + (defun update-frame-background-mode () + (mapc 'frame-set-background-mode (frame-list))) + + (defun set-background-mode (mode) + (set-default frame-background-mode mode) + (setf frame-background-mode mode) + (update-frame-background-mode)) + + ;; Executable + (when my/light-default + (switch-themes)) +#+end_src diff --git a/lisp/themes/dark-default-theme.el b/lisp/themes/dark-default-theme.el index da4d5f2..3098d61 100644 --- a/lisp/themes/dark-default-theme.el +++ b/lisp/themes/dark-default-theme.el @@ -42,6 +42,8 @@ '(mode-line ((t :foreground "gray60" :background "black" :inverse-video nil))) '(eldoc-highlight-function-argument ((t :foreground "dodger blue"))) + '(sml/charging ((t (:inherit sml/global :foreground "forest green")))) + `(rainbow-delimiters-depth-1-face ((t :foreground ,rainbow-purple))) `(rainbow-delimiters-depth-2-face ((t :foreground ,rainbow-green))) `(rainbow-delimiters-depth-3-face ((t :foreground ,rainbow-blue))) @@ -52,6 +54,28 @@ `(rainbow-delimiters-depth-8-face ((t :foreground ,rainbow-8))) `(rainbow-delimiters-depth-9-face ((t :foreground ,rainbow-purple))) + '(org-todo ((t (:foreground "Pink" :bold t :inherit fixed-pitch)))) + + '(opr/STUFF-todo-face ((t :foreground "goldenrod"))) + '(opr/FUTURE-todo-face ((t :foreground "medium spring green"))) + '(opr/NEXT-todo-face ((t :foreground "cyan"))) + '(opr/WAIT-todo-face ((t :foreground "yellow"))) + + '(opr/ONE-todo-face ((t :foreground "royal blue"))) + + '(opr/CLOCK-todo-face ((t :foreground "dark gray"))) + '(opr/INACT-todo-face ((t :foreground "dark gray"))) + '(opr/BACKLOG-todo-face ((t :foreground "dark gray"))) + '(opr/ABANDON-todo-face ((t :foreground "dark gray"))) + + '(opr/META-todo-face ((t :foreground "white"))) + '(opr/SEQ-todo-face ((t :foreground "white"))) + '(opr/EMPTY-todo-face ((t :foreground "white"))) + '(opr/HOLD-todo-face ((t :foreground "red"))) + + '(tab-bar ((t :foreground "#70FF00" :background "dark slate gray" :inherit 'fixed-pitch))) + '(tab-bar-tab ((t :background "gray6"))) + '(tab-bar-tab-inactive ((t :background "dark slate gray")))) ) ;;###autoload diff --git a/lisp/themes/light-default-theme.el b/lisp/themes/light-default-theme.el new file mode 100644 index 0000000..7b34b84 --- /dev/null +++ b/lisp/themes/light-default-theme.el @@ -0,0 +1,50 @@ +;;; light-default-theme.el --- -*- lexical-binding: t -*- + +;; Copyright (C) 2020 Benson Chu + +;; Author: Benson Chu +;; Created: [2020-09-07 14:00] + +;; This file is not part of GNU Emacs + +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;;; Code: + +(deftheme light-default) + +(custom-theme-set-faces + 'light-default + + '(org-todo ((t (:foreground "Red1" :bold t :inherit fixed-pitch)))) + + `(rainbow-delimiters-depth-1-face ((t :foreground "DodgerBlue3"))) + `(rainbow-delimiters-depth-2-face ((t :foreground "green4"))) + `(rainbow-delimiters-depth-3-face ((t :foreground "magenta"))) + `(rainbow-delimiters-depth-4-face ((t :foreground "dark goldenrod"))) + `(rainbow-delimiters-depth-5-face ((t :foreground "DeepPink1"))) + `(rainbow-delimiters-depth-6-face ((t :foreground "dark red"))) + `(rainbow-delimiters-depth-7-face ((t :foreground "dark green"))) + `(rainbow-delimiters-depth-8-face ((t :foreground "firebrick"))) + `(rainbow-delimiters-depth-9-face ((t :foreground "medium sea green")))) + +;;###autoload +(when load-file-name + (add-to-list 'custom-theme-load-path + (file-name-as-directory (file-name-directory load-file-name)))) + +(provide-theme 'light-default) +;;; light-default-theme.el ends here diff --git a/lisp/themes/same-defaults-theme.el b/lisp/themes/same-defaults-theme.el new file mode 100644 index 0000000..61ca5ed --- /dev/null +++ b/lisp/themes/same-defaults-theme.el @@ -0,0 +1,61 @@ +;;; same-defaults-theme.el --- -*- lexical-binding: t -*- + +;; Copyright (C) 2020 Benson Chu + +;; Author: Benson Chu +;; Created: [2020-09-07 15:36] + +;; This file is not part of GNU Emacs + +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;;; Code: + +(deftheme same-defaults) + +(defvar my/fixed-pitch-height 100) +(defvar my/variable-pitch-height 130) + +(custom-theme-set-faces + 'same-defaults + `(default ((t (:family "Roboto Mono" :height ,my/fixed-pitch-height)))) + `(fixed-pitch ((t (:family "Roboto Mono" :height ,my/fixed-pitch-height)))) + `(variable-pitch ((t (:family "Linux Libertine" :height ,my/variable-pitch-height)))) + ;; '(org-todo ((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t :inherit fixed-pitch)) + ;; (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t :inherit fixed-pitch)) + ;; (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t :inherit fixed-pitch)) + ;; (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t :inherit fixed-pitch)) + ;; (t (:inverse-video t :bold t :inherit fixed-pitch)))) + ) + +;; (when (member "Roboto Mono" (font-family-list)) +;; (custom-theme-set-faces +;; 'same-defaults +;; `(default ((t (:family "RobotoMono" :height ,my/fixed-pitch-height)))) +;; `(fixed-pitch ((t (:family "Roboto Mono" :height ,my/fixed-pitch-height)))))) + +;; (when (member "Linux Libertine" (font-family-list)) +;; (custom-theme-set-faces +;; 'same-defaults +;; `(variable-pitch ((t (:family "Linux Libertine" :height ,my/variable-pitch-height :width normal)))))) + +;;###autoload +(when load-file-name + (add-to-list 'custom-theme-load-path + (file-name-as-directory (file-name-directory load-file-name)))) + +(provide-theme 'same-defaults) +;;; same-defaults-theme.el ends here