branch: elpa/gruvbox-theme commit a8a87a9cd06074dbff717d98cc52d13bcd47ae45 Author: Greduan <eduanlava...@gmail.com> Commit: Greduan <eduanlava...@gmail.com>
Initial support for terminal with 256 colors --- gruvbox-theme.el | 138 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 76 insertions(+), 62 deletions(-) diff --git a/gruvbox-theme.el b/gruvbox-theme.el index 4586ea2dff..43945f3d1a 100644 --- a/gruvbox-theme.el +++ b/gruvbox-theme.el @@ -11,20 +11,25 @@ ;;; Commentary: -;; A port of the Gruvbox colorscheme for Vim, built on top of the new -;; built-in theme support in Emacs 24. +;; A port of the Gruvbox colorscheme for Vim, built on top of the new built-in +;; theme support in Emacs 24. ;; ;; This theme contains my own modifications and it's a bit opinionated ;; sometimes, deviating from the original because of it. I try to stay true to -;; the original, however. +;; the original as much as possible, however. I only make changes where I would +;; have made the changes on the original. +;; +;; Since there is no direct equivalent in syntax highlighting from Vim to Emacs +;; some stuff may look different, especially in stuff like JS2-mode, where it +;; adds stuff that Vim doesn't have, in terms of syntax. ;;; Credits: -;; Pavel Pertsev created the original theme for Vim on which this port +;; Pavel Pertsev created the original theme for Vim, on which this port ;; is based. -;; Lee Machin is who created first port of the original theme, off of which -;; I'm working on to make it better. +;; Lee Machin created the first port of the original theme, which I'm working on +;; to make better and more feature complete. ;;; Code: @@ -32,7 +37,6 @@ (error "requires Emacs 24 or later.")) (deftheme gruvbox "A retro-groove colour theme") - (let ((gruvbox-dark0_hard (if (display-graphic-p) "#1d2021" "color-234")) (gruvbox-dark0 (if (display-graphic-p) "#282828" "color-235")) (gruvbox-dark0_soft (if (display-graphic-p) "#32302f" "color-236")) @@ -51,26 +55,35 @@ (gruvbox-light3 (if (display-graphic-p) "#bdae93" "color-248")) (gruvbox-light4 (if (display-graphic-p) "#a89984" "color-246")) - ;; neutral, no 256-color version, will request - ;(gruvbox-red (if (display-graphic-p) "#fb4934" "color-")) - ;(gruvbox-green (if (display-graphic-p) "#b8bb26" "color-")) - ;(gruvbox-yellow (if (display-graphic-p) "#fabd2f" "color-")) - ;(gruvbox-blue (if (display-graphic-p) "#83a598" "color-")) - ;(gruvbox-purple (if (display-graphic-p) "#d3869b" "color-")) - ;(gruvbox-aqua (if (display-graphic-p) "#8ec07c" "color-")) - ;(gruvbox-orange (if (display-graphic-p) "#fe8019" "color-"))) - (gruvbox-red "#fb4934") - (gruvbox-green "#b8bb26") - (gruvbox-yellow "#fabd2f") - (gruvbox-blue "#83a598") - (gruvbox-purple "#d3869b") - (gruvbox-aqua "#8ec07c") - (gruvbox-orange "#fe8019")) + (gruvbox-bright_red (if (display-graphic-p) "#fb4933" "color-167")) + (gruvbox-bright_green (if (display-graphic-p) "#b8bb26" "color-142")) + (gruvbox-bright_yellow (if (display-graphic-p) "#fabd2f" "color-214")) + (gruvbox-bright_blue (if (display-graphic-p) "#83a598" "color-109")) + (gruvbox-bright_purple (if (display-graphic-p) "#d3869b" "color-175")) + (gruvbox-bright_aqua (if (display-graphic-p) "#8ec07c" "color-108")) + (gruvbox-bright_orange (if (display-graphic-p) "#fe8019" "color-208")) + + ;; neutral, no 256-color code, requested, nice work-around meanwhile + (gruvbox-neutral_red (if (display-graphic-p) "#fb4934" "#d75f5f")) + (gruvbox-neutral_green (if (display-graphic-p) "#b8bb26" "#afaf00")) + (gruvbox-neutral_yellow (if (display-graphic-p) "#fabd2f" "#ffaf00")) + (gruvbox-neutral_blue (if (display-graphic-p) "#83a598" "#87afaf")) + (gruvbox-neutral_purple (if (display-graphic-p) "#d3869b" "#d787af")) + (gruvbox-neutral_aqua (if (display-graphic-p) "#8ec07c" "#87af87")) + (gruvbox-neutral_orange (if (display-graphic-p) "#fe8019" "#ff8700")) + + (gruvbox-faded_red (if (display-graphic-p) "#9d0006" "color-88")) + (gruvbox-faded_green (if (display-graphic-p) "#79740e" "color-100")) + (gruvbox-faded_yellow (if (display-graphic-p) "#b57614" "color-136")) + (gruvbox-faded_blue (if (display-graphic-p) "#076678" "color-24")) + (gruvbox-faded_purple (if (display-graphic-p) "#8f3f71" "color-96")) + (gruvbox-faded_aqua (if (display-graphic-p) "#427b58" "color-66")) + (gruvbox-faded_orange (if (display-graphic-p) "#af3a03" "color-130"))) (custom-theme-set-faces 'gruvbox - ;;UI + ;; UI `(default ((t (:background ,gruvbox-dark0 :foreground ,gruvbox-light0)))) `(cursor ((t (:background ,gruvbox-light0)))) `(mode-line ((t (:box nil :background ,gruvbox-dark4 :foreground ,gruvbox-dark0)))) @@ -79,26 +92,26 @@ `(linum ((t (:foreground ,gruvbox-dark4)))) `(hl-line ((t (:background ,gruvbox-dark1)))) `(region ((t (:background ,gruvbox-dark2)))) ;;selection - `(minibuffer-prompt ((t (:background ,gruvbox-dark0 :foreground ,gruvbox-green :bold t)))) + `(minibuffer-prompt ((t (:background ,gruvbox-dark0 :foreground ,gruvbox-neutral_green :bold t)))) - ;;Built-in syntax - `(font-lock-builtin-face ((t (:foreground ,gruvbox-orange)))) - `(font-lock-constant-face ((t (:foreground ,gruvbox-purple)))) + ;; Built-in syntax + `(font-lock-builtin-face ((t (:foreground ,gruvbox-neutral_orange)))) + `(font-lock-constant-face ((t (:foreground ,gruvbox-neutral_purple)))) `(font-lock-comment-face ((t (:foreground ,gruvbox-dark4)))) - `(font-lock-function-name-face ((t (:foreground ,gruvbox-green)))) - `(font-lock-keyword-face ((t (:foreground ,gruvbox-red)))) - `(font-lock-string-face ((t (:foreground ,gruvbox-green)))) - `(font-lock-variable-name-face ((t (:foreground ,gruvbox-blue)))) - `(font-lock-type-face ((t (:foreground ,gruvbox-purple)))) - `(font-lock-warning-face ((t (:foreground ,gruvbox-red :bold t)))) - - ;;whitespace-mode + `(font-lock-function-name-face ((t (:foreground ,gruvbox-neutral_green)))) + `(font-lock-keyword-face ((t (:foreground ,gruvbox-neutral_red)))) + `(font-lock-string-face ((t (:foreground ,gruvbox-neutral_green)))) + `(font-lock-variable-name-face ((t (:foreground ,gruvbox-neutral_blue)))) + `(font-lock-type-face ((t (:foreground ,gruvbox-neutral_purple)))) + `(font-lock-warning-face ((t (:foreground ,gruvbox-neutral_red :bold t)))) + + ;; whitespace-mode `(whitespace-space ((t (:background ,gruvbox-dark0 :foreground ,gruvbox-dark4)))) `(whitespace-hspace ((t (:background ,gruvbox-dark0 :foreground ,gruvbox-dark4)))) `(whitespace-tab ((t (:background ,gruvbox-dark0 :foreground ,gruvbox-dark4)))) `(whitespace-newline ((t (:background ,gruvbox-dark0 :foreground ,gruvbox-dark4)))) - `(whitespace-trailing ((t (:background ,gruvbox-dark1 :foreground ,gruvbox-red)))) - `(whitespace-line ((t (:background ,gruvbox-dark1 :foreground ,gruvbox-red)))) + `(whitespace-trailing ((t (:background ,gruvbox-dark1 :foreground ,gruvbox-neutral_red)))) + `(whitespace-line ((t (:background ,gruvbox-dark1 :foreground ,gruvbox-neutral_red)))) `(whitespace-space-before-tab ((t (:background ,gruvbox-dark0 :foreground ,gruvbox-dark4)))) `(whitespace-indentation ((t (:background ,gruvbox-dark0 :foreground ,gruvbox-dark4)))) `(whitespace-empty ((t (:background nil :foreground nil)))) @@ -106,7 +119,7 @@ ;; TODO ;; - Replace with variable values - ;;RainbowDelimiters + ;; RainbowDelimiters `(rainbow-delimiters-depth-1-face ((t (:foreground "#458588")))) `(rainbow-delimiters-depth-2-face ((t (:foreground "#b16286")))) `(rainbow-delimiters-depth-3-face ((t (:foreground "#cc241d")))) @@ -121,51 +134,52 @@ `(rainbow-delimiters-depth-12-face ((t (:foreground "#d65d0e")))) `(rainbow-delimiters-unmatched-face ((t (:background nil :foreground ,gruvbox-light0)))) - ;;linum-relative + ;; linum-relative `(linum-relative-current-face ((t (:background ,gruvbox-dark1 :foreground ,gruvbox-light4)))) - ;;Smartparens + ;; Smartparens `(sp-pair-overlay-face ((t (:background ,gruvbox-dark2)))) ;`(sp-wrap-overlay-face ((t (:inherit sp-wrap-overlay-face)))) ;`(sp-wrap-tag-overlay-face ((t (:inherit sp-wrap-overlay-face)))) - `(sp-show-pair-match-face ((t (:background ,gruvbox-dark2)))) ;;Pair tags highlight - `(sp-show-pair-mismatch-face ((t (:background "red")))) ;;Highlight for bracket without pair + `(sp-show-pair-match-face ((t (:background ,gruvbox-dark2)))) ;; Pair tags highlight + `(sp-show-pair-mismatch-face ((t (:background ,gruvbox-neutral_red)))) ;; Highlight for bracket without pair - ;;elscreen - `(elscreen-tab-background-face ((t (:box nil :background ,gruvbox-dark0)))) ;;tab bar, not tabs - `(elscreen-tab-control-face ((t (:box nil :background ,gruvbox-dark2 :foreground ,gruvbox-red :underline nil)))) ;;the controls, arrows 'n' stuff - `(elscreen-tab-current-screen-face ((t (:box nil :background ,gruvbox-dark4 :foreground ,gruvbox-dark0)))) ;;current tab - `(elscreen-tab-other-screen-face ((t (:box nil :background ,gruvbox-dark2 :foreground ,gruvbox-light4 :underline nil)))) ;;inactive tab + ;; elscreen + `(elscreen-tab-background-face ((t (:box nil :background ,gruvbox-dark0)))) ;; Tab bar, not the tabs + `(elscreen-tab-control-face ((t (:box nil :background ,gruvbox-dark2 :foreground ,gruvbox-neutral_red :underline nil)))) ;; The controls + `(elscreen-tab-current-screen-face ((t (:box nil :background ,gruvbox-dark4 :foreground ,gruvbox-dark0)))) ;; Current tab + `(elscreen-tab-other-screen-face ((t (:box nil :background ,gruvbox-dark2 :foreground ,gruvbox-light4 :underline nil)))) ;; Inactive tab - ;;ag (The Silver Searcher) - `(ag-hit-face ((t (:foreground ,gruvbox-blue)))) - `(ag-match-face ((t (:foreground ,gruvbox-red)))) + ;; ag (The Silver Searcher) + `(ag-hit-face ((t (:foreground ,gruvbox-neutral_blue)))) + `(ag-match-face ((t (:foreground ,gruvbox-neutral_red)))) - ;;Diffs + ;; Diffs `(diff-changed ((t (:background nil :foreground ,gruvbox-light1)))) - `(diff-added ((t (:background nil :foreground ,gruvbox-green)))) - `(diff-removed ((t (:background nil :foreground ,gruvbox-red)))) + `(diff-added ((t (:background nil :foreground ,gruvbox-neutral_green)))) + `(diff-removed ((t (:background nil :foreground ,gruvbox-neutral_red)))) `(diff-indicator-changed ((t (:inherit diff-changed)))) `(diff-indicator-added ((t (:inherit diff-added)))) `(diff-indicator-removed ((t (:inherit diff-removed)))) - ;;Term + ;; Term `(term-color-black ((t (:foreground ,gruvbox-dark1)))) - `(term-color-blue ((t (:foreground ,gruvbox-blue)))) - `(term-color-cyan ((t (:foreground ,gruvbox-aqua)))) - `(term-color-green ((t (:foreground ,gruvbox-green)))) - `(term-color-magenta ((t (:foreground ,gruvbox-purple)))) - `(term-color-red ((t (:foreground ,gruvbox-red)))) + `(term-color-blue ((t (:foreground ,gruvbox-neutral_blue)))) + `(term-color-cyan ((t (:foreground ,gruvbox-neutral_aqua)))) + `(term-color-green ((t (:foreground ,gruvbox-neutral_green)))) + `(term-color-magenta ((t (:foreground ,gruvbox-neutral_purple)))) + `(term-color-red ((t (:foreground ,gruvbox-neutral_red)))) `(term-color-white ((t (:foreground ,gruvbox-light1)))) - `(term-color-yellow ((t (:foreground ,gruvbox-yellow)))) + `(term-color-yellow ((t (:foreground ,gruvbox-neutral_yellow)))) `(term-default-fg-color ((t (:foreground ,gruvbox-light0)))) `(term-default-bg-color ((t (:background ,gruvbox-dark0))))) (custom-theme-set-variables 'gruvbox - `(ansi-color-names-vector [,gruvbox-dark1 ,gruvbox-red ,gruvbox-green ,gruvbox-yellow - ,gruvbox-blue ,gruvbox-purple ,gruvbox-aqua ,gruvbox-light1]))) + `(ansi-color-names-vector [,gruvbox-dark1 ,gruvbox-neutral_red + ,gruvbox-neutral_green ,gruvbox-neutral_yellow ,gruvbox-neutral_blue + ,gruvbox-neutral_purple ,gruvbox-neutral_aqua ,gruvbox-light1]))) (defun gruvbox-set-ansi-color-names-vector () "Give comint and the like the same colours as the term colours we set"