From 1f56a9b9b2f22d5df1db092c7fbe51485f569449 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Sat, 1 Dec 2018 10:30:57 -0500 Subject: [PATCH] [emacs] add cpitclaudel's tangomod{,-dark} themes and amin/{dark,light} helpers to switch between them along with corresponding sml mode-line theme --- init.org | 36 +++++++- lisp/tangomod-dark-theme.el | 170 ++++++++++++++++++++++++++++++++++++ lisp/tangomod-theme.el | 154 ++++++++++++++++++++++++++++++++ rc.org | 1 - 4 files changed, 358 insertions(+), 3 deletions(-) create mode 100644 lisp/tangomod-dark-theme.el create mode 100644 lisp/tangomod-theme.el diff --git a/init.org b/init.org index a6e4d11..4ff8b94 100644 --- a/init.org +++ b/init.org @@ -348,7 +348,7 @@ in my shell. (exec-path-from-shell-copy-env "SSH_AUTH_SOCK")) #+end_src -** Only one custom theme at a time +** COMMENT Only one custom theme at a time #+begin_src emacs-lisp (defadvice load-theme (before clear-previous-themes activate) @@ -1697,16 +1697,48 @@ Emacs package that displays available keybindings in popup :config (which-key-mode)) #+end_src +** theme + +#+begin_src emacs-lisp +(add-to-list 'custom-theme-load-path "~/.emacs.d/lisp") +(load-theme 'tangomod t) +#+end_src + ** [[https://github.com/Malabarba/smart-mode-line][smart-mode-line]] #+begin_src emacs-lisp (use-package smart-mode-line :config (sml/setup) - ;; (sml/apply-theme 'light) + (sml/apply-theme 'light) (remove-hook 'display-time-hook 'sml/propertize-time-string)) #+end_src +** theme helper functions + +#+begin_src emacs-lisp +(defun amin/light () + "Load light theme(s)." + (interactive) + (progn + (mapc #'disable-theme custom-enabled-themes) + (load-theme 'tangomod t) + (sml/apply-theme 'light))) + +(defun amin/dark () + "Load dark theme(s)." + (interactive) + (progn + (mapc #'disable-theme custom-enabled-themes) + (load-theme 'tangomod-dark t) + (sml/apply-theme 'dark))) + +(amin--leader-keys + "t" '(:ignore t :wk "theme") + "t d" 'amin/dark + "t l" 'amin/light) +#+end_src + ** [[https://github.com/bbatsov/crux][crux]] #+begin_src emacs-lisp diff --git a/lisp/tangomod-dark-theme.el b/lisp/tangomod-dark-theme.el new file mode 100644 index 0000000..ccf441b --- /dev/null +++ b/lisp/tangomod-dark-theme.el @@ -0,0 +1,170 @@ +;;; tango-dark-theme.el --- Tango-based custom theme for faces + +;; Copyright (C) 2010-2015 Free Software Foundation, Inc. + +;; Authors: Chong Yidong +;; Jan Moringen + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary + +;; The colors in this theme come from the Tango palette, which is in +;; the public domain: http://tango.freedesktop.org/ + +;;; Code: + +(deftheme tangomod-dark + "Face colors using the Tango palette (dark background). +Basic, Font Lock, Isearch, Gnus, Message, Ediff, Flyspell, +Semantic, and Ansi-Color faces are included.") + +(let ((class '((class color) (min-colors 89))) + ;; Tango palette colors. + (butter-1 "#fce94f") (butter-2 "#edd400") (butter-3 "#c4a000") + (orange-1 "#fcaf3e") (orange-2 "#f57900") (orange-3 "#ce5c00") + (choc-1 "#e9b96e") (choc-2 "#c17d11") (choc-3 "#8f5902") + (cham-1 "#8ae234") (cham-2 "#73d216") (cham-3 "#4e9a06") + (blue-1 "#729fcf") (blue-2 "#3465a4") (blue-3 "#204a87") + (plum-1 "#e090d7") (plum-2 "#75507b") (plum-3 "#5c3566") + (red-1 "#ef2929") (red-2 "#cc0000") (red-3 "#a40000") + (alum-1 "#eeeeec") (alum-2 "#d3d7cf") (alum-3 "#babdb6") + (alum-4 "#888a85") (alum-5 "#555753") (alum-6 "#2e3436") + ;; Not in Tango palette; used for better contrast. + (cham-0 "#b4fa70") (blue-0 "#8cc4ff") (plum-0 "#e9b2e3") + (red-0 "#ff4b4b") (alum-5.5 "#41423f") (alum-7 "#212526")) + + (custom-theme-set-faces + 'tangomod-dark + ;; Ensure sufficient contrast on low-color terminals. + `(default ((((class color) (min-colors 4096)) + (:foreground ,alum-1 :background ,alum-6)) + (((class color) (min-colors 256)) + (:foreground ,alum-1 :background "#222")) + (,class + (:foreground ,alum-1 :background "black")))) + `(cursor ((,class (:background ,butter-1)))) + ;; Highlighting faces + `(fringe ((,class (:background ,alum-7)))) + `(highlight ((,class (:foreground ,alum-6 :background ,butter-2)))) + `(region ((,class (:background ,alum-5)))) + `(secondary-selection ((,class (:background ,blue-3)))) + `(isearch ((,class (:foreground ,alum-1 :background ,orange-3)))) + `(lazy-highlight ((,class (:background ,choc-3)))) + `(trailing-whitespace ((,class (:background ,red-3)))) + ;; Paren face + `(show-paren-match ((,class (:background ,blue-3)))) + ;; Mode line faces + `(mode-line ((,class + ;; (:box (:line-width -1 :style released-button) + (:background ,alum-2 :foreground ,alum-6)))) + `(mode-line-inactive ((,class + ;; (:box (:line-width -1 :style released-button) + (:background ,alum-5 :foreground ,alum-1)))) + `(compilation-mode-line-fail ((,class (:foreground ,red-3)))) + `(compilation-mode-line-run ((,class (:foreground ,orange-3)))) + `(compilation-mode-line-exit ((,class (:foreground ,cham-3)))) + ;; Escape and prompt faces + `(minibuffer-prompt ((,class (:foreground ,cham-0)))) + `(escape-glyph ((,class (:foreground ,butter-3)))) + `(error ((,class (:foreground ,red-0)))) + `(warning ((,class (:foreground ,orange-1)))) + `(success ((,class (:foreground ,cham-1)))) + ;; Font lock faces + `(font-lock-builtin-face ((,class (:foreground ,cham-3)))) + `(font-lock-comment-face ((,class (:slant italic :foreground ,alum-3)))) + ;; `(font-lock-comment-face ((,class (:foreground ,cham-2)))) + `(font-lock-constant-face ((,class (:weight bold :foreground ,plum-0)))) + `(font-lock-function-name-face ((,class (:foreground ,butter-1)))) + `(font-lock-keyword-face ((,class (:foreground ,cham-0)))) + `(font-lock-string-face ((,class (:foreground ,choc-1)))) + `(font-lock-type-face ((,class (:foreground ,blue-0)))) + `(font-lock-variable-name-face ((,class (:foreground ,orange-1)))) + `(font-lock-negation-char-face ((,class (:weight bold)))) + ;; Button and link faces + `(link ((,class (:underline t :foreground ,blue-1)))) + `(link-visited ((,class (:underline t :foreground ,blue-2)))) + ;; Gnus faces + `(gnus-group-news-1 ((,class (:foreground ,plum-1)))) + `(gnus-group-news-1-low ((,class (:foreground ,plum-2)))) + `(gnus-group-news-2 ((,class (:foreground ,blue-1)))) + `(gnus-group-news-2-low ((,class (:foreground ,blue-2)))) + `(gnus-group-news-3 ((,class (:foreground ,cham-1)))) + `(gnus-group-news-3-low ((,class (:foreground ,cham-2)))) + `(gnus-group-news-4 ((,class (:foreground ,plum-0)))) + `(gnus-group-news-4-low ((,class (:foreground ,choc-2)))) + `(gnus-group-news-5 ((,class (:foreground ,orange-1)))) + `(gnus-group-news-5-low ((,class (:foreground ,orange-2)))) + `(gnus-group-news-low ((,class (:foreground ,butter-2)))) + `(gnus-group-mail-1 ((,class (:foreground ,plum-1)))) + `(gnus-group-mail-1-low ((,class (:foreground ,plum-2)))) + `(gnus-group-mail-2 ((,class (:foreground ,blue-1)))) + `(gnus-group-mail-2-low ((,class (:foreground ,blue-2)))) + `(gnus-group-mail-3 ((,class (:foreground ,cham-1)))) + `(gnus-group-mail-3-low ((,class (:foreground ,cham-2)))) + `(gnus-group-mail-low ((,class (:foreground ,butter-2)))) + `(gnus-header-content ((,class (:weight normal :foreground ,butter-3)))) + `(gnus-header-from ((,class (:foreground ,butter-2)))) + `(gnus-header-subject ((,class (:foreground ,cham-1)))) + `(gnus-header-name ((,class (:foreground ,blue-1)))) + `(gnus-header-newsgroups ((,class (:foreground ,choc-2)))) + ;; Message faces + `(message-header-name ((,class (:foreground ,blue-1)))) + `(message-header-cc ((,class (:foreground ,butter-3)))) + `(message-header-other ((,class (:foreground ,choc-2)))) + `(message-header-subject ((,class (:foreground ,cham-1)))) + `(message-header-to ((,class (:foreground ,butter-2)))) + `(message-cited-text ((,class (:foreground ,cham-1)))) + `(message-separator ((,class (:foreground ,plum-1)))) + ;; SMerge faces + `(smerge-refined-change ((,class (:background ,blue-3)))) + ;; Ediff faces + `(ediff-current-diff-A ((,class (:background ,alum-5)))) + `(ediff-fine-diff-A ((,class (:background ,blue-3)))) + `(ediff-even-diff-A ((,class (:background ,alum-5.5)))) + `(ediff-odd-diff-A ((,class (:background ,alum-5.5)))) + `(ediff-current-diff-B ((,class (:background ,alum-5)))) + `(ediff-fine-diff-B ((,class (:background ,choc-3)))) + `(ediff-even-diff-B ((,class (:background ,alum-5.5)))) + `(ediff-odd-diff-B ((,class (:background ,alum-5.5)))) + ;; Flyspell faces + `(flyspell-duplicate ((,class (:underline ,orange-1)))) + `(flyspell-incorrect ((,class (:underline ,red-1)))) + ;; Semantic faces + `(semantic-decoration-on-includes ((,class (:underline ,alum-4)))) + `(semantic-decoration-on-private-members-face + ((,class (:background ,plum-3)))) + `(semantic-decoration-on-protected-members-face + ((,class (:background ,choc-3)))) + `(semantic-decoration-on-unknown-includes + ((,class (:background ,red-3)))) + `(semantic-decoration-on-unparsed-includes + ((,class (:background ,alum-5.5)))) + `(semantic-tag-boundary-face ((,class (:overline ,blue-1)))) + `(semantic-unmatched-syntax-face ((,class (:underline ,red-1))))) + + (custom-theme-set-variables + 'tangomod-dark + `(ansi-color-names-vector [,alum-7 ,red-0 ,cham-0 ,butter-1 + ,blue-1 ,plum-1 ,blue-0 ,alum-1]))) + +(provide-theme 'tangomod-dark) + +;; Local Variables: +;; no-byte-compile: t +;; End: + +;;; tangomod-dark-theme.el ends here diff --git a/lisp/tangomod-theme.el b/lisp/tangomod-theme.el new file mode 100644 index 0000000..5ec1bd1 --- /dev/null +++ b/lisp/tangomod-theme.el @@ -0,0 +1,154 @@ +;;; tangomod-theme.el --- Tango-based custom theme for faces + +;; Copyright (C) 2010-2013 Free Software Foundation, Inc. + +;; Authors: Chong Yidong +;; Jan Moringen + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary + +;; The colors in this theme come from the Tango palette, which is in +;; the public domain: http://tango.freedesktop.org/ + +;;; Code: + +(deftheme tangomod + "Face colors using the Tango palette (light background). +Basic, Font Lock, Isearch, Gnus, Message, Ediff, Flyspell, +Semantic, and Ansi-Color faces are included.") + +(let ((class '((class color) (min-colors 89))) + ;; Tango palette colors. + (butter-1 "#fce94f") (butter-2 "#edd400") (butter-3 "#c4a000") + (orange-1 "#fcaf3e") (orange-2 "#f57900") (orange-3 "#ce5c00") + (choc-1 "#e9b96e") (choc-2 "#c17d11") (choc-3 "#8f5902") + (cham-1 "#8ae234") (cham-2 "#73d216") (cham-3 "#4e9a06") + (blue-1 "#729fcf") (blue-2 "#3465a4") (blue-3 "#204a87") + (plum-1 "#ad7fa8") (plum-2 "#75507b") (plum-3 "#5c3566") + (red-1 "#ef2929") (red-2 "#cc0000") (red-3 "#a40000") + (alum-1 "#ffffff") (alum-2 "#d3d7cf") (alum-3 "#babdb6") + (alum-4 "#888a85") (alum-5 "#5f615c") (alum-6 "#000000") + ;; Not in Tango palette; used for better contrast. + (cham-4 "#346604") (blue-0 "#8cc4ff") (orange-4 "#b35000")) + + (custom-theme-set-faces + 'tangomod + `(default ((,class (:foreground ,alum-6 :background ,alum-1)))) + `(cursor ((,class (:background ,blue-3)))) + ;; Highlighting faces + `(fringe ((,class (:background "#FFFFFF")))) ;; EDITED + `(highlight ((,class (:foreground ,alum-6 :background ,butter-2)))) + ;; Disabled for talk at PL offsite + ;; `(highlight ((,class (:background ,alum-3)))) + `(region ((,class (:background ,alum-3)))) + `(secondary-selection ((,class (:background ,blue-0)))) + `(isearch ((,class (:foreground "#ffffff" :background ,orange-3)))) + `(lazy-highlight ((,class (:background ,choc-1)))) + `(trailing-whitespace ((,class (:background ,red-1)))) + ;; Paren face + `(show-paren-match ((,class (:background ,blue-1)))) + ;; Mode line faces + `(mode-line ((,class (:box (:line-width -1 :style released-button) + :background ,alum-2 :foreground ,alum-6)))) + `(mode-line-inactive ((,class (:box (:line-width -1 :style released-button) + :background ,alum-4 :foreground ,alum-6)))) + ;; Escape and prompt faces + `(minibuffer-prompt ((,class (:weight bold :foreground ,blue-3)))) + `(escape-glyph ((,class (:foreground ,red-3)))) + `(error ((,class (:foreground ,red-3)))) + `(warning ((,class (:foreground ,orange-3)))) + `(success ((,class (:foreground ,cham-3)))) + ;; Font lock faces + `(font-lock-builtin-face ((,class (:foreground ,plum-2)))) + `(font-lock-comment-face ((,class (:slant italic :foreground ,alum-5)))) + `(font-lock-constant-face ((,class (:weight bold :foreground ,blue-3)))) + `(font-lock-function-name-face ((,class (:foreground ,red-3)))) + `(font-lock-keyword-face ((,class (:foreground ,cham-4)))) + `(font-lock-string-face ((,class (:foreground ,plum-3)))) + `(font-lock-type-face ((,class (:foreground ,blue-3)))) + `(font-lock-variable-name-face ((,class (:foreground ,orange-4)))) + ;; Button and link faces + `(link ((,class (:underline t :foreground ,blue-3)))) + `(link-visited ((,class (:underline t :foreground ,blue-2)))) + ;; Gnus faces + `(gnus-group-news-1 ((,class (:weight bold :foreground ,plum-3)))) + `(gnus-group-news-1-low ((,class (:foreground ,plum-3)))) + `(gnus-group-news-2 ((,class (:weight bold :foreground ,blue-3)))) + `(gnus-group-news-2-low ((,class (:foreground ,blue-3)))) + `(gnus-group-news-3 ((,class (:weight bold :foreground ,red-3)))) + `(gnus-group-news-3-low ((,class (:foreground ,red-3)))) + `(gnus-group-news-4 ((,class (:weight bold :foreground ,"#7a4c02")))) + `(gnus-group-news-4-low ((,class (:foreground ,"#7a4c02")))) + `(gnus-group-news-5 ((,class (:weight bold :foreground ,orange-3)))) + `(gnus-group-news-5-low ((,class (:foreground ,orange-3)))) + `(gnus-group-news-low ((,class (:foreground ,alum-4)))) + `(gnus-group-mail-1 ((,class (:weight bold :foreground ,plum-3)))) + `(gnus-group-mail-1-low ((,class (:foreground ,plum-3)))) + `(gnus-group-mail-2 ((,class (:weight bold :foreground ,blue-3)))) + `(gnus-group-mail-2-low ((,class (:foreground ,blue-3)))) + `(gnus-group-mail-3 ((,class (:weight bold :foreground ,cham-3)))) + `(gnus-group-mail-3-low ((,class (:foreground ,cham-3)))) + `(gnus-group-mail-low ((,class (:foreground ,alum-4)))) + `(gnus-header-content ((,class (:foreground ,cham-3)))) + `(gnus-header-from ((,class (:weight bold :foreground ,butter-3)))) + `(gnus-header-subject ((,class (:foreground ,red-3)))) + `(gnus-header-name ((,class (:foreground ,blue-3)))) + `(gnus-header-newsgroups ((,class (:foreground ,alum-4)))) + ;; Message faces + `(message-header-name ((,class (:foreground ,blue-3)))) + `(message-header-cc ((,class (:foreground ,butter-3)))) + `(message-header-other ((,class (:foreground ,choc-2)))) + `(message-header-subject ((,class (:foreground ,red-3)))) + `(message-header-to ((,class (:weight bold :foreground ,butter-3)))) + `(message-cited-text ((,class (:slant italic :foreground ,alum-5)))) + `(message-separator ((,class (:weight bold :foreground ,cham-3)))) + ;; SMerge + `(smerge-refined-change ((,class (:background ,plum-1)))) + ;; Ediff + `(ediff-current-diff-A ((,class (:background ,blue-1)))) + `(ediff-fine-diff-A ((,class (:background ,plum-1)))) + `(ediff-current-diff-B ((,class (:background ,butter-1)))) + `(ediff-fine-diff-B ((,class (:background ,orange-1)))) + ;; Flyspell + `(flyspell-duplicate ((,class (:underline ,orange-1)))) + `(flyspell-incorrect ((,class (:underline ,red-1)))) + ;; Semantic faces + `(semantic-decoration-on-includes ((,class (:underline ,cham-4)))) + `(semantic-decoration-on-private-members-face + ((,class (:background ,alum-2)))) + `(semantic-decoration-on-protected-members-face + ((,class (:background ,alum-2)))) + `(semantic-decoration-on-unknown-includes + ((,class (:background ,choc-3)))) + `(semantic-decoration-on-unparsed-includes + ((,class (:underline ,orange-3)))) + `(semantic-tag-boundary-face ((,class (:overline ,blue-1)))) + `(semantic-unmatched-syntax-face ((,class (:underline ,red-1))))) + + (custom-theme-set-variables + 'tangomod + `(ansi-color-names-vector [,alum-6 ,red-3 ,cham-3 ,butter-3 + ,blue-3 ,plum-3 ,blue-1 ,alum-1]))) + +(provide-theme 'tangomod) + +;; Local Variables: +;; no-byte-compile: t +;; End: + +;;; tangomod-theme.el ends here diff --git a/rc.org b/rc.org index e671f4e..c96454e 100644 --- a/rc.org +++ b/rc.org @@ -3865,7 +3865,6 @@ output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill exec swayidle \ timeout 120 '[ -f ~/.nosleep ] || swaymsg "output * dpms off"' \ resume '[ -f ~/.nosleep ] || swaymsg "output * dpms on"' \ - before-sleep swaylock ### Key bindings -- 2.20.1