;;; theme.el -*- lexical-binding: t; -*- ;;; ;;; Author: Jakob L. Kreuze ;;; URL: https://git.sr.ht/~jakob/.emacs.d/ ;;; ;;; This is my custom theme, the code for which is very loosely adapted from ;;; moe-theme.el [1], but most of the palette has been altered to emulate the ;;; appearance of my old setup of Emacs in a terminal emulator. ;;; ;;; [1]: https://github.com/kuanyui/moe-theme.el (deftheme chayote "Inspired by the appearance of Emacs in my terminal emulator.") ;; The colors have been extracted into a variable, `palette', and a macro, ;; `with-palette', to provide access to the theme's color definitions without ;; significantly polluting the global namespace. To help me in modifying the ;; theme, I've defined a function similar to `list-colors-display', but for ;; showing the colors in the palette I've defined. (defvar palette '((yellow-1 "#ffd787") (yellow-2 "#ffd700") (yellow-3 "#c4a000") (yellow-3-5 "#aaaa11") (yellow-4 "#875f00") (orange-1 "#ffaf87") (orange-2 "#ff8700") (orange-3 "#ff5d17") (orange-4 "#d75f00") (orange-5 "#af5f00") (magenta-1 "#ff7bbb") (magenta-2 "#ff4ea3") (magenta-3 "#ff1f8b") (green-1 "#87ff87") (green-2 "#a1db00") (green-3 "#5faf00") (green-4 "#008700") (green-5 "#005f00") (cyan-1 "#afd7d7") (cyan-2 "#87ffd7") (cyan-3 "#00d7af") (cyan-4 "#00ac8a") (cyan-5 "#5faf87") (cyan-6 "#005f5f") (cyan-7 "#236f73") (blue-1 "#1fb6d3") (blue-2 "#1f5bff") (blue-3 "#005f87") (blue-4 "#5f7ab1") (blue-5 "#0000af") (blue-6 "#00005f") (purple-1 "#d18aff") (purple-2 "#af5fff") (purple-3 "#9a08ff") (purple-4 "#6c0099") (red-1 "#ef2929") (red-2 "#dd0000") (red-3 "#a40000") (red-4 "#5f0000") (white-1 "#f0e9dc") (white-2 "#c6c6c6") (white-3 "#b2b2b2") (black-1 "#a8a8a8") (black-2 "#8a8a8a") (black-2-5 "#6c6c6c") (black-3 "#4e4e4e") (black-4 "#3a3a3a") (black-5 "#303539") (black-6 "#000000") (LIGHT_BG "#fdfde7") (white-0 "#eeeeee") (green-02 "#5fd700") (green-01 "#d7ff00") (green-0 "#d7ff5f") (green-00 "#d7ff87") (cyan-0 "#d7ffd7") (blue-01 "#c3c9f8") (blue-0 "#afd7ff") (blue-00 "#d7d7ff") (yellow-0 "#ffff87") (yellow-00 "#ffffaf") (purple-0 "#af87ff") (purple-00 "#e6a8df") (red-0 "#ff4b4b") (red-00 "#ffafaf") (magenta-0 "#ffafd7") (magenta-00 "#ffd7ff") (orange-0 "#ffaf87") (orange-00 "#ffd787") (orange-000 "#ffd7af") (linum-dark "#87875f") (linum-light "#d7d7af")) "The palette of colors in use with my 'chayote' theme.") (defmacro with-palette (&rest form) "Evaluate `FORM' in a `let' containing the theme's colors." `(let ((class '((class color) (min-colors 89))) ,@palette) ,@form)) (defun display-palette () "Display names of colors in `PALETTE', and show what they look like." (interactive) (with-help-window "*Chayote Colors*" (with-current-buffer standard-output (erase-buffer) (dolist (color palette) (let* ((name (symbol-name (first color))) (value (second color))) (put-text-property 0 (length name) 'font-lock-face `(:foreground ,value) name) (insert name) (insert (propertize " " 'display '(space :align-to (- right 9)))) (insert " ") (put-text-property 0 (length value) 'font-lock-face `(:background ,value) value) (insert value) (terpri))) (set-buffer-modified-p nil) (setq truncate-lines t)))) (with-palette (custom-theme-set-faces 'chayote `(default ((,class (:foreground ,white-1 :background ,black-5 :family "Terminus" :height 90)))) `(italic ((,class (:italic t)))) `(cursor ((,class (:background ,white-0)))) `(variable-pitch ((,class (:inherit default)))) `(link ((,class (:foreground ,blue-1 :underline t)))) ;; Highlighting faces `(highlight ((,class (:background ,black-3)))) `(hl-line ((,class (:background ,black-4)))) `(highlight-symbol-face ((,class (:background ,green-5)))) `(region ((,class (:background ,blue-4)))) `(secondary-selection ((,class (:background ,blue-3 :foreground ,white-0)))) `(isearch ((,class (:foreground ,white-1 :background ,orange-3)))) `(lazy-highlight ((,class (:background ,magenta-3 :foreground ,white-1)))) `(trailing-whitespace ((,class (:background ,red-3)))) `(show-paren-match ((,class (:background ,blue-3 :foreground nil)))) `(header-line ((,class (:background ,blue-3 :foreground ,white-0)))) `(help-argument-name ((,class (:foreground ,magenta-1 :italic t)))) `(eldoc-highlight-function-argument ((,class (:foreground ,green-01 :bold t :underline t :background ,green-5)))) ;; Mode line & frames' faces `(mode-line ((,class (:box nil :background ,white-1 :foreground ,black-5)))) `(mode-line-inactive ((,class (:background ,white-3 :foreground ,black-5)))) `(mode-line-buffer-id ((,class (:box nil :foreground ,black-5 :background nil)))) `(vertical-border ((,class (:foreground ,black-3 :background ,black-3)))) ;; Escape and prompt faces `(minibuffer-prompt ((,class (:foreground ,blue-1)))) `(escape-glyph ((,class (:foreground ,yellow-3)))) `(error ((,class (:foreground ,red-0)))) `(warning ((,class (:foreground ,orange-1)))) `(success ((,class (:foreground ,green-1)))) ;; Font lock faces `(font-lock-builtin-face ((,class (:foreground ,cyan-1)))) `(font-lock-comment-delimiter-face ((,class (:inherit font-lock-comment-face)))) `(font-lock-comment-face ((,class (:foreground ,orange-2)))) `(font-lock-constant-face ((,class (:foreground ,cyan-2)))) `(font-lock-doc-face ((,class (:inherit font-lock-string-face)))) `(font-lock-doc-string-face ((,class (:inherit font-lock-string-face)))) `(font-lock-function-name-face ((,class (:foreground ,blue-0)))) `(font-lock-keyword-face ((,class (:foreground ,blue-1)))) `(font-lock-negation-char-face ((,class (:foreground ,red-0)))) `(font-lock-preprocessor-face ((,class (:inherit font-lock-builtin-face)))) `(font-lock-regexp-grouping-backslash ((,class (:foreground ,yellow-1)))) `(font-lock-regexp-grouping-construct ((,class (:foreground ,purple-1)))) `(font-lock-string-face ((,class (:foreground ,orange-1)))) `(font-lock-type-face ((,class (:foreground ,green-1)))) `(font-lock-variable-name-face ((,class (:foreground ,yellow-1)))) `(font-lock-warning-face ((,class (:weight bold :foreground ,red-2)))) ;; Info `(Info-quoted ((,class (:inherit default)))) ;; company `(company-tooltip ((,class (:background ,black-4)))) `(company-scrollbar-bg ((,class (:background ,black-4)))) `(company-scrollbar-fg ((,class (:background ,orange-2)))) `(company-tooltip-selection ((,class (:background ,black-3)))) `(company-tooltip-common ((,class (:foreground ,blue-1)))) `(company-tooltip-annotation ((,class (:foreground ,cyan-1)))) ;; AUCTeX `(font-latex-sedate-face ((,class (:inherit font-lock-keyword-face)))) ;; Gnus `(gnus-group-mail-3 ((,class (:foreground ,green-2)))) ;; org-mode `(org-document-info-keyword ((,class (:foreground ,red-0)))) `(org-document-title ((,class (:inherit org-document-info-keyword)))) `(org-document-info ((,class (:inherit org-document-info-keyword)))) `(org-meta-line ((,class (:inherit org-document-info-keyword)))) `(org-archived ((,class (:slant italic)))) `(org-checkbox ((,class (:background ,white-2 :foreground ,black-3 :box (:line-width 1 :style released-button))))) `(org-date ((,class (:foreground ,green-3 :underline t)))) `(org-done ((,class (:foreground ,green-4 :background ,green-00 :box (:line-width 1 :style none))))) `(org-todo ((,class (:foreground ,red-3 :background ,orange-0 :box (:line-width 1 :style none))))) `(org-level-1 ((,class (:foreground ,purple-00)))) `(org-level-2 ((,class (:foreground ,blue-0)))) `(org-level-3 ((,class (:foreground ,cyan-3)))) `(org-level-4 ((,class (:foreground ,green-02)))) `(org-level-5 ((,class (:foreground ,red-2)))) `(org-level-6 ((,class (:foreground ,orange-2)))) `(org-level-7 ((,class (:foreground ,magenta-2)))) `(org-level-8 ((,class (:foreground ,yellow-2)))) `(org-tag ((,class (:background ,black-1 :foreground ,white-0)))) `(org-column ((,class (:background ,yellow-00 :foreground ,black-3)))) `(org-column-title ((,class (:background ,blue-0 :foreground ,black-5 :underline t)))) `(org-agenda-structure ((,class (:foreground ,cyan-4 :background nil :bold nil)))) `(org-deadline-announce ((,class (:foreground ,red-3)))) `(org-scheduled ((,class (:foreground ,black-2)))) `(org-scheduled-previously ((,class (:foreground ,red-1)))) `(org-scheduled-today ((,class (:foreground ,blue-2)))) `(org-special-keyword ((,class (:foreground ,green-3)))) `(org-table ((,class (:background ,black-4 :foreground ,white-3)))) ;; `(org-time-grid ((,class (:foreground ,white-4)))) `(org-upcoming-deadline ((,class (:foreground ,red-3)))) ;; `(org-warning ((,class (:foreground ,white-0 :background ,red-3)))) `(org-warning ((,class (:foreground ,white-0 :background ,red-4)))) `(org-formula ((,class (:foreground ,purple-2)))) `(org-headline-done ((,class (:foreground ,green-2)))) `(org-hide ((,class (:foreground ,LIGHT_BG)))) `(org-code ((,class (:foreground ,blue-2 :background ,white-1)))) ;; `(org-link ((,class (:foreground ,blue-2 :underline ,blue-2)))) `(org-link ((,class (:inherit link)))) `(org-footnote ((,class (:foreground ,magenta-3)))) `(org-ellipsis ((,class (:foreground ,red-2)))) `(org-agenda-clocking ((,class (:foreground ,blue-3 :background ,blue-0)))) `(org-agenda-date ((,class (:foreground ,blue-1 :background nil :underline nil)))) `(org-agenda-date-weekend ((,class (:foreground ,purple-2 :background nil :slant italic :bold nil)))) `(org-agenda-date-today ((,class (:foreground ,blue-0 :background nil :underline t)))) `(org-agenda-column-dateline ((,class (:foreground ,white-0 :background ,yellow-0 :underline t)))) `(org-agenda-todo ((,class (:foreground ,white-0 :background ,red-2)))) `(org-agenda-done ((,class (:foreground ,green-3 :background ,nil)))) `(org-agenda-dimmed-todo-face ((,class (:foreground ,white-0 :background ,red-2)))) `(org-priority ((,class (:foreground ,red-1 :background ,nil)))) `(org-block ((,class (:foreground ,white-1 :background ,black-4 :extend t)))) `(org-block-begin-line ((,class (:foreground ,black-3)))) `(org-block-end-line ((,class (:foreground ,black-3)))) `(org-block-background ((,class (:background ,white-1)))) ;; `(org-block-begin-line ((,class (:foreground ,blue-3 :background ,blue-0)))) ;; `(org-block-end-line ((,class (:foreground ,white-2 :background ,white-1)))) `(org-quote ((,class (:foreground ,blue-3 :background ,blue-00)))) `(org-mode-line-clock ((,class (:foreground ,blue-3 :background ,blue-0 :bold t)))) `(org-mode-line-clock-overrun ((,class (:foreground ,white-0 :background ,red-1 :bold t)))) ;; `(org-verbatim ((,class (:foreground ,blue-3 :background ,blue-00 :bold nil)))) `(org-verbatim ((,class (:foreground ,blue-1 :background ,black-4)))) ;; erc `(erc-input-face ((,class (:foreground ,white-1)))) `(erc-button ((,class (:inherit link)))) ;; smartparens `(sp-pair-overlay-face ((,class (:inherit default))))) (custom-theme-set-variables 'chayote `(ansi-color-names-vector [,black-5 ,red-0 ,green-0 ,yellow-1 ,blue-1 ,purple-1 ,blue-0 ,white-1]))) (enable-theme 'chayote)