From cf4523f323705236ddb415aa36252426dbe6b81d Mon Sep 17 00:00:00 2001 From: Andrew Hyatt Date: Thu, 19 May 2011 21:01:27 -0400 Subject: [PATCH] Improvements with emacsclients, and less confusing variable names --- solarized-definitions.el | 406 +++++++++++++++++++-------------------- 1 file changed, 196 insertions(+), 210 deletions(-) diff --git a/solarized-definitions.el b/solarized-definitions.el index 67c4076..689912d 100644 --- a/solarized-definitions.el +++ b/solarized-definitions.el @@ -60,235 +60,221 @@ will use the 256 degraded color mode." column is a different set, one of which will be chosen based on term capabilities, etc.") +(defun solarized-face-for-index (facespec index) + "Creates a face from FACESPEC where the colors use the names of + the `solarized-colors'." + (let ((new-fontspec (copy-list facespec))) + (dolist (property '(:foreground :background :color)) + (when (plist-get new-fontspec property) + (plist-put new-fontspec property + (nth index (assoc (plist-get new-fontspec property) + solarized-colors))))) + (when (plist-get new-fontspec :box) + (plist-put new-fontspec :box (solarized-face-for-index + (plist-get new-fontspec :box) index))) + new-fontspec)) + +(defun solarized-faces (facespecs) + (mapcar (lambda (facespec-with-name) + (let* ((name (car facespec-with-name)) + (facespec (second facespec-with-name)) + (facespec-tty-256 (solarized-face-for-index facespec 3)) + (facespec-tty-term (solarized-face-for-index facespec 4)) + (facespec-default (solarized-face-for-index facespec 2))) + `(,name + ((((type tty) (min-colors 256)) ,facespec-tty-256) + (((type tty)) ,facespec-tty-term) + (t ,facespec-default))))) facespecs)) + (defun solarized-color-definitions (mode) - (flet ((find-color (name) - (let ((index (if window-system - (if solarized-degrade - 3 - 2) - (if (= solarized-termcolors 256) - 3 - 4)))) - (nth index (assoc name solarized-colors))))) - (let ((base03 (find-color 'base03)) - (base02 (find-color 'base02)) - (base01 (find-color 'base01)) - (base00 (find-color 'base00)) - (base0 (find-color 'base0)) - (base1 (find-color 'base1)) - (base2 (find-color 'base2)) - (base3 (find-color 'base3)) - (yellow (find-color 'yellow)) - (orange (find-color 'orange)) - (red (find-color 'red)) - (magenta (find-color 'magenta)) - (violet (find-color 'violet)) - (blue (find-color 'blue)) - (cyan (find-color 'cyan)) - (green (find-color 'green)) - (bold (if solarized-bold 'bold 'normal)) - (underline (if solarized-underline t nil)) - (italic (if solarized-italic 'italic 'normal))) - (when (eq 'light mode) - (rotatef base03 base3) - (rotatef base02 base2) - (rotatef base01 base1) - (rotatef base00 base0)) - `((;; basic - (default ((t (:foreground ,base0 ,:background ,base03)))) - (cursor - ((t (:foreground ,base0 :background ,base03 :inverse-video t)))) - (escape-glyph-face ((t (:foreground ,red)))) - (fringe ((t (:foreground ,base01 :background ,base02)))) - (linum ((t (:foreground ,base01 :background ,base02)))) - (header-line ((t (:foreground ,base0 :background ,base2)))) - (highlight ((t (:background ,base02)))) - (hl-line ((t (:background ,base02)))) - (isearch ((t (:foreground ,yellow :inverse-video t)))) - (lazy-highlight ((t (:background ,base2 :foreground ,base00)))) - (link ((t (:foreground ,violet :underline ,underline)))) - (link-visited ((t (:foreground ,magenta :underline ,underline)))) - (menu ((t (:foreground ,base0 :background ,base02)))) - (minibuffer-prompt ((t (:foreground ,blue)))) - (mode-line - ((t (:foreground ,base1 :background ,base02 - :box (:line-width 1 :color ,base1))))) - (mode-line-buffer-id ((t (:foreground ,base1)))) - (mode-line-inactive - ((t (:foreground ,base0 :background ,base02 - :box (:line-width 1 :color ,base02))))) - (region ((t (:background ,base02)))) - (secondary-selection ((t (:background ,base02)))) - (trailing-whitespace ((t (:foreground ,red :inverse-video t)))) - (vertical-border ((t (:foreground ,base0)))) + (let ((background-extreme (if (eq 'light mode) 'base3 'base03)) + (background-medium (if (eq 'light mode) 'base2 'base02)) + (background-subtle (if (eq 'light mode) 'base1 'base01)) + (background-grey (if (eq 'light mode) 'base0 'base00)) + (foreground-extreme (if (eq 'light mode) 'base03 'base3)) + (foreground-medium (if (eq 'light mode) 'base02 'base2)) + (foreground-subtle (if (eq 'light mode) 'base01 'base1)) + (foreground-grey (if (eq 'light mode) 'base00 'base0)) + (bold (if solarized-bold 'bold 'normal)) + (underline (if solarized-underline t nil)) + (italic (if solarized-italic 'italic 'normal))) + (list + ;; First list is for faces + (append + (solarized-faces + `( ;; basic + (default (:foreground ,foreground-grey :background ,background-extreme)) + (cursor (:foreground ,foreground-grey :background ,background-extreme :inverse-video t)) + (fringe (:foreground ,background-subtle :background ,background-medium)) + (header-line (:foreground ,foreground-grey :background ,foreground-medium)) + (highlight (:background ,background-medium)) + (hl-line (:background ,background-medium)) + (isearch (:foreground yellow :inverse-video t)) + (lazy-highlight (:background ,foreground-medium :foreground ,background-grey)) + (link (:foreground violet :,underline ,underline)) + (link-visited (:foreground magenta :,underline ,underline)) + (menu (:foreground ,foreground-grey :background ,background-medium)) + (minibuffer-prompt (:foreground blue)) + (mode-line (:foreground ,foreground-subtle :background ,background-medium + :box (:line-width 1 :color ,foreground-subtle))) + (mode-line-buffer-id (:foreground ,foreground-subtle)) + (mode-line-inactive (:foreground ,foreground-grey :background ,background-medium + :box (:line-width 1 :color ,background-medium))) + (region (:background ,background-medium)) + (secondary-selection (:background ,background-medium)) + (trailing-whitespace (:foreground red :inverse-video t)) + (vertical-border (:foreground ,foreground-grey)) ;; comint - (comint-highlight-prompt ((t (:foreground ,blue)))) + (comint-highlight-prompt (:foreground blue)) ;; compilation - (compilation-info ((t (:foreground ,green :weight ,bold)))) - (compilation-warning ((t (:foreground ,orange :weight ,bold)))) + (compilation-info (:foreground green :weight ,bold)) + (compilation-warning (:foreground orange :weight ,bold)) ;; customize - (custom-button - ((t (:background ,base02 - :box (:line-width 2 :style released-button))))) - (custom-button-mouse ((t (:inherit custom-button :foreground ,base1)))) - (custom-button-pressed - ((t (:inherit custom-button-mouse - :box (:line-width 2 :style pressed-button))))) - (custom-comment-tag ((t (:background ,base02)))) - (custom-comment-tag ((t (:background ,base02)))) - (custom-documentation ((t (:inherit default)))) - (custom-group-tag ((t (:foreground ,orange :weight ,bold)))) - (custom-link ((t (:foreground ,violet)))) - (custom-state ((t (:foreground ,green)))) - (custom-variable-tag ((t (:foreground ,orange :weight ,bold)))) + (custom-button (:background ,background-medium + :box (:line-width 2 :style released-button))) + (custom-button-mouse (:inherit custom-button :foreground ,foreground-subtle)) + (custom-button-pressed (:inherit custom-button-mouse + :box (:line-width 2 :style pressed-button))) + (custom-comment-tag (:background ,background-medium)) + (custom-comment-tag (:background ,background-medium)) + (custom-documentation (:inherit default)) + (custom-group-tag (:foreground orange :weight ,bold)) + (custom-link (:foreground violet)) + (custom-state (:foreground green)) + (custom-variable-tag (:foreground orange :weight ,bold)) ;; diff - (diff-added ((t (:foreground ,green :inverse-video t)))) - (diff-changed ((t (:foreground ,yellow :inverse-video t)))) - (diff-removed ((t (:foreground ,red :inverse-video t)))) - (diff-header ((t (:background ,base01)))) - (diff-file-header - ((t (:background ,base1 :foreground ,base01 :weight ,bold)))) - (diff-refine-change ((t (:background ,base1)))) - ;; IDO - (ido-only-match ((t (:foreground ,green)))) - (ido-subdir ((t (:foreground ,blue)))) - (ido-first-match ((t (:foreground ,green :weight ,bold)))) + (diff-added (:foreground green :inverse-video t)) + (diff-changed (:foreground yellow :inverse-video t)) + (diff-removed (:foreground red :inverse-video t)) + (diff-header (:background ,background-subtle)) + (diff-file-header (:background ,foreground-subtle :foreground ,background-subtle :weight ,bold)) + (diff-refine-change (:background ,foreground-subtle)) ;; emacs-wiki - (emacs-wiki-bad-link-face - ((t (:foreground ,red :underline ,underline)))) - (emacs-wiki-link-face ((t (:foreground ,blue :underline ,underline)))) - (emacs-wiki-verbatim-face - ((t (:foreground ,base00 :underline ,underline)))) + (emacs-wiki-bad-link-face (:foreground red :,underline ,underline)) + (emacs-wiki-link-face (:foreground blue :,underline ,underline)) + (emacs-wiki-verbatim-face (:foreground ,background-grey :,underline ,underline)) ;; font-lock - (font-lock-builtin-face ((t (:foreground ,green)))) - (font-lock-comment-face ((t (:foreground ,base01 :slant ,italic)))) - (font-lock-constant-face ((t (:foreground ,cyan)))) - (font-lock-function-name-face ((t (:foreground ,blue)))) - (font-lock-keyword-face ((t (:foreground ,green)))) - (font-lock-string-face ((t (:foreground ,cyan)))) - (font-lock-type-face ((t (:foreground ,yellow)))) - (font-lock-variable-name-face ((t (:foreground ,blue)))) - (font-lock-warning-face ((t (:foreground ,red :weight ,bold)))) - (font-lock-doc-face ((t (:foreground ,cyan :slant ,italic)))) - (font-lock-color-constant-face ((t (:foreground ,green)))) - (font-lock-comment-delimiter-face - ((t (:foreground ,base01 :weight ,bold)))) - (font-lock-doc-string-face ((t (:foreground ,green)))) - (font-lock-preprocessor-face ((t (:foreground ,orange)))) - (font-lock-reference-face ((t (:foreground ,cyan)))) - (font-lock-negation-char-face ((t (:foreground ,red)))) - (font-lock-other-type-face ((t (:foreground ,blue :slant ,italic)))) - (font-lock-regexp-grouping-construct ((t (:foreground ,orange)))) - (font-lock-special-keyword-face ((t (:foreground ,magenta)))) - (font-lock-exit-face ((t (:foreground ,red)))) - (font-lock-other-emphasized-face - ((t (:foreground ,violet :weight ,bold :slant ,italic)))) - (font-lock-regexp-grouping-backslash ((t (:foreground ,yellow)))) + (font-lock-builtin-face (:foreground green)) + (font-lock-comment-face (:foreground ,background-subtle :slant ,italic)) + (font-lock-constant-face (:foreground cyan)) + (font-lock-function-name-face (:foreground blue)) + (font-lock-keyword-face (:foreground green)) + (font-lock-string-face (:foreground cyan)) + (font-lock-type-face (:foreground yellow)) + (font-lock-variable-name-face (:foreground blue)) + (font-lock-warning-face (:foreground red :weight ,bold)) + (font-lock-doc-face (:foreground cyan :slant ,italic)) + (font-lock-color-constant-face (:foreground green)) + (font-lock-comment-delimiter-face (:foreground ,background-subtle :weight ,bold)) + (font-lock-doc-string-face (:foreground green)) + (font-lock-preprocessor-face (:foreground orange)) + (font-lock-reference-face (:foreground cyan)) + (font-lock-negation-char-face (:foreground red)) + (font-lock-other-type-face (:foreground blue :slant ,italic)) + (font-lock-regexp-grouping-construct (:foreground orange)) + (font-lock-special-keyword-face (:foreground magenta)) + (font-lock-exit-face (:foreground red)) + (font-lock-other-emphasized-face (:foreground violet :weight ,bold :slant ,italic)) + (font-lock-regexp-grouping-backslash (:foreground yellow)) ;; info - (info-xref ((t (:foreground ,blue :underline ,underline)))) - (info-xref-visited ((t (:inherit info-xref :foreground ,magenta)))) + (info-xref (:foreground blue :,underline ,underline)) + (info-xref-visited (:inherit info-xref :foreground magenta)) ;; org - (org-hide ((t (:foreground ,base03)))) - (org-todo ((t (:foreground ,base03 :background ,red :weight ,bold)))) - (org-done ((t (:foreground ,green :weight ,bold)))) - (org-todo-kwd-face ((t (:foreground ,red :background ,base03)))) - (org-done-kwd-face ((t (:foreground ,green :background ,base03)))) - (org-project-kwd-face ((t (:foreground ,violet :background ,base03)))) - (org-waiting-kwd-face ((t (:foreground ,orange :background ,base03)))) - (org-someday-kwd-face ((t (:foreground ,blue :background ,base03)))) - (org-started-kwd-face ((t (:foreground ,yellow :background ,base03)))) - (org-cancelled-kwd-face ((t (:foreground ,green :background ,base03)))) - (org-delegated-kwd-face ((t (:foreground ,cyan :background ,base03)))) + (org-hide (:foreground ,background-extreme)) + (org-todo (:foreground ,background-extreme :background red :weight ,bold)) + (org-done (:foreground green :weight ,bold)) + (org-todo-kwd-face (:foreground red :background ,background-extreme)) + (org-done-kwd-face (:foreground green :background ,background-extreme)) + (org-project-kwd-face (:foreground violet :background ,background-extreme)) + (org-waiting-kwd-face (:foreground orange :background ,background-extreme)) + (org-someday-kwd-face (:foreground blue :background ,background-extreme)) + (org-started-kwd-face (:foreground yellow :background ,background-extreme)) + (org-cancelled-kwd-face (:foreground green :background ,background-extreme)) + (org-delegated-kwd-face (:foreground cyan :background ,background-extreme)) ;; show-paren - (show-paren-match-face ((t (:background ,cyan :foreground ,base3)))) - (show-paren-mismatch-face ((t (:background ,red :foreground ,base3)))) + (show-paren-match-face (:background cyan :foreground ,foreground-extreme)) + (show-paren-mismatch-face (:background red :foreground ,foreground-extreme)) ;; widgets - (widget-field - ((t (:box (:line-width 1 :color ,base00) :inherit default)))) - (widget-single-line-field ((t (:inherit widget-field)))) + (widget-field (:box (:line-width 1 :color ,background-grey) :inherit default)) + (widget-single-line-field (:inherit widget-field)) ;; extra modules ;; ------------- ;; gnus - (gnus-cite-1 ((t (:foreground ,magenta)))) - (gnus-cite-2 ((t (:foreground ,base2)))) - (gnus-cite-3 ((t (:foreground ,base3)))) - (gnus-cite-4 ((t (:foreground ,base1)))) - (gnus-cite-5 ((t (:foreground ,magenta)))) - (gnus-cite-6 ((t (:foreground ,base2)))) - (gnus-cite-7 ((t (:foreground ,base3)))) - (gnus-cite-8 ((t (:foreground ,base1)))) - (gnus-cite-9 ((t (:foreground ,base2)))) - (gnus-cite-10 ((t (:foreground ,base3)))) - (gnus-cite-11 ((t (:foreground ,blue)))) - (gnus-group-mail-1 ((t (:foreground ,base3 :weight ,bold)))) - (gnus-group-mail-1-empty ((t (:foreground ,base3)))) - (gnus-group-mail-2 ((t (:foreground ,base2 :weight ,bold)))) - (gnus-group-mail-2-empty ((t (:foreground ,base2)))) - (gnus-group-mail-3 ((t (:foreground ,magenta :weight ,bold)))) - (gnus-group-mail-3-empty ((t (:foreground ,magenta)))) - (gnus-group-mail-low ((t (:foreground ,base00 :weight ,bold)))) - (gnus-group-mail-low-empty ((t (:foreground ,base00)))) - (gnus-group-news-1 ((t (:foreground ,base1 :weight ,bold)))) - (gnus-group-news-1-empty ((t (:foreground ,base1)))) - (gnus-group-news-2 ((t (:foreground ,blue :weight ,bold)))) - (gnus-group-news-2-empty ((t (:foreground ,blue)))) - (gnus-group-news-low ((t (:foreground ,violet :weight ,bold)))) - (gnus-group-news-low-empty ((t (:foreground ,violet)))) - (gnus-header-content ((t (:foreground ,cyan :slant ,italic)))) - (gnus-header-from ((t (:foreground ,base2)))) - (gnus-header-name ((t (:foreground ,blue)))) - (gnus-header-newsgroups ((t (:foreground ,green :slant ,italic)))) - (gnus-header-subject ((t (:foreground ,base1)))) - (gnus-server-agent ((t (:foreground ,base3 :weight ,bold)))) - (gnus-server-closed ((t (:foreground ,base1 :slant ,italic)))) - (gnus-server-denied ((t (:foreground ,base2 :weight ,bold)))) - (gnus-server-offline ((t (:foreground ,green :weight ,bold)))) - (gnus-server-opened ((t (:foreground ,cyan :weight ,bold)))) - (gnus-splash ((t (:foreground ,base2)))) - (gnus-summary-high-ancient ((t (:foreground ,magenta :weight ,bold)))) - (gnus-summary-high-read ((t (:foreground ,base1 :weight ,bold)))) - (gnus-summary-high-ticked ((t (:foreground ,base3 :weight ,bold)))) - (gnus-summary-high-undownloaded - ((t (:foreground ,base2 :weight ,bold)))) - (gnus-summary-low-ancient ((t (:foreground ,magenta :slant ,italic)))) - (gnus-summary-low-read ((t (:foreground ,base1 :slant ,italic)))) - (gnus-summary-low-ticked ((t (:foreground ,base3 :slant ,italic)))) - (gnus-summary-low-undownloaded - ((t (:foreground ,base2 :slant ,italic)))) - (gnus-summary-normal-ancient ((t (:foreground ,magenta)))) - (gnus-summary-normal-read ((t (:foreground ,base1)))) - (gnus-summary-normal-ticked ((t (:foreground ,base3)))) - (gnus-summary-normal-undownloaded ((t (:foreground ,base2)))) + (gnus-cite-1 (:foreground magenta)) + (gnus-cite-2 (:foreground ,foreground-medium)) + (gnus-cite-3 (:foreground ,foreground-extreme)) + (gnus-cite-4 (:foreground ,foreground-subtle)) + (gnus-cite-5 (:foreground magenta)) + (gnus-cite-6 (:foreground ,foreground-medium)) + (gnus-cite-7 (:foreground ,foreground-extreme)) + (gnus-cite-8 (:foreground ,foreground-subtle)) + (gnus-cite-9 (:foreground ,foreground-medium)) + (gnus-cite-10 (:foreground ,foreground-extreme)) + (gnus-cite-11 (:foreground blue)) + (gnus-group-mail-1 (:foreground ,foreground-extreme :weight ,bold)) + (gnus-group-mail-1-empty (:foreground ,foreground-extreme)) + (gnus-group-mail-2 (:foreground ,foreground-medium :weight ,bold)) + (gnus-group-mail-2-empty (:foreground ,foreground-medium)) + (gnus-group-mail-3 (:foreground magenta :weight ,bold)) + (gnus-group-mail-3-empty (:foreground magenta)) + (gnus-group-mail-low (:foreground ,background-grey :weight ,bold)) + (gnus-group-mail-low-empty (:foreground ,background-grey)) + (gnus-group-news-1 (:foreground ,foreground-subtle :weight ,bold)) + (gnus-group-news-1-empty (:foreground ,foreground-subtle)) + (gnus-group-news-2 (:foreground blue :weight ,bold)) + (gnus-group-news-2-empty (:foreground blue)) + (gnus-group-news-low (:foreground violet :weight ,bold)) + (gnus-group-news-low-empty (:foreground violet)) + (gnus-header-content (:foreground cyan :slant ,italic)) + (gnus-header-from (:foreground ,foreground-medium)) + (gnus-header-name (:foreground blue)) + (gnus-header-newsgroups (:foreground green :slant ,italic)) + (gnus-header-subject (:foreground ,foreground-subtle)) + (gnus-server-agent (:foreground ,foreground-extreme :weight ,bold)) + (gnus-server-closed (:foreground ,foreground-subtle :slant ,italic)) + (gnus-server-denied (:foreground ,foreground-medium :weight ,bold)) + (gnus-server-offline (:foreground green :weight ,bold)) + (gnus-server-opened (:foreground cyan :weight ,bold)) + (gnus-splash (:foreground ,foreground-medium)) + (gnus-summary-high-ancient (:foreground magenta :weight ,bold)) + (gnus-summary-high-read (:foreground ,foreground-subtle :weight ,bold)) + (gnus-summary-high-ticked (:foreground ,foreground-extreme :weight ,bold)) + (gnus-summary-high-undownloaded (:foreground ,foreground-medium :weight ,bold)) + (gnus-summary-low-ancient (:foreground magenta :slant ,italic)) + (gnus-summary-low-read (:foreground ,foreground-subtle :slant ,italic)) + (gnus-summary-low-ticked (:foreground ,foreground-extreme :slant ,italic)) + (gnus-summary-low-undownloaded (:foreground ,foreground-medium :slant ,italic)) + (gnus-summary-normal-ancient (:foreground magenta)) + (gnus-summary-normal-read (:foreground ,foreground-subtle)) + (gnus-summary-normal-ticked (:foreground ,foreground-extreme)) + (gnus-summary-normal-undownloaded (:foreground ,foreground-medium)) ;; Flymake - (flymake-errline ((t (:background ,orange)))) - (flymake-warnline ((t (:background ,violet)))) + (flymake-errline (:background orange)) + (flymake-warnline (:background violet)) ;; whitespace - (whitespace-empty ((t (:foreground ,red)))) - (whitespace-hspace ((t (:foreground ,orange)))) - (whitespace-indentation ((t (:foreground ,base02)))) - (whitespace-space ((t (:foreground ,base02)))) - (whitespace-space-after-tab ((t (:foreground ,cyan)))) - (whitespace-space-before-tab ((t (:foreground ,red :weight ,bold)))) - (whitespace-tab ((t (:foreground ,base02)))) + (whitespace-empty (:foreground red)) + (whitespace-hspace (:foreground orange)) + (whitespace-indentation (:foreground ,background-medium)) + (whitespace-space (:foreground ,background-medium)) + (whitespace-space-after-tab (:foreground cyan)) + (whitespace-space-before-tab (:foreground red :weight ,bold)) + (whitespace-tab (:foreground ,background-medium)) (whitespace-trailing - ((t (:background ,base02 :foreground ,red :weight ,bold)))) - (whitespace-highlight-face ((t (:background ,blue :foreground ,red)))) + (:background ,background-medium :foreground red :weight ,bold)) + (whitespace-highlight-face (:background blue :foreground red)) ;; Message - (message-mml ((t (:foreground ,blue)))) - (message-cited-text ((t (:foreground ,base2)))) - (message-separator ((t (:foreground ,base3)))) - (message-header-xheader ((t (:foreground ,violet)))) - (message-header-name ((t (:foreground ,cyan)))) - (message-header-other ((t (:foreground ,red)))) + (message-mml (:foreground blue)) + (message-cited-text (:foreground ,foreground-medium)) + (message-separator (:foreground ,foreground-extreme)) + (message-header-xheader (:foreground violet)) + (message-header-name (:foreground cyan)) + (message-header-other (:foreground red)) (message-header-newsgroups - ((t (:foreground ,yellow :weight ,bold :slant ,italic)))) - (message-header-subject ((t (:foreground ,base00)))) - (message-header-cc ((t (:foreground ,green :weight ,bold)))) - (message-header-to ((t (:foreground ,base1 :weight ,bold))))) - ((foreground-color . ,base0) - (background-color . ,base03) - (background-mode . ,mode) - (cursor-color . ,base0)))))) + (:foreground yellow :weight ,bold :slant ,italic)) + (message-header-subject (:foreground ,background-grey)) + (message-header-cc (:foreground green :weight ,bold)) + (message-header-to (:foreground ,foreground-subtle :weight ,bold))))) + `((background-mode . ,mode))))) (defmacro create-solarized-theme (mode) (let* ((theme-name (intern (concat "solarized-" (symbol-name mode))))