/doom-gruvbox-material-theme

Doom Emacs theme based on Gruvbox Material by @sainnhe

Primary LanguageEmacs LispGNU General Public License v3.0GPL-3.0

doom-gruvbox-material

Introduction

Gruvbox Material is a modified version of Gruvbox, the contrast is adjusted to be softer in order to protect developers’ eyes.

This is a port of Gruvbox Material to be used in Doom Emacs. As the original, it has three palettes:

material
Carefully designed to have a soft contrast
mix
Color palette obtained by calculating the mean of the other two
original
The color palette used in the original gruvbox

additionally, it has three background contrast options: soft, medium and hard. Since the colorscheme comes in two variants: light and dark, this project provides a total of 18 possible configurations.

Installation

Copy the doom-gruvbox-material-theme.el and doom-gruvbox-material-light-theme.el files into your $HOME/.doom.d/themes directory. Add the following lines to your ~/.doom.d/config.el:

;; `gruvbox-material' contrast and palette options
(setq doom-gruvbox-material-background  "medium"  ; or hard (defaults to soft)
     doom-gruvbox-material-palette     "mix") ; or original (defaults to material)

;; `gruvbox-material-light' contrast and palette options
(setq doom-gruvbox-material-light-background  "medium" ; or hard (defaults to soft)
      doom-gruvbox-material-light-palette     "mix") ; or original (defaults to material)

;; set `doom-theme'
(setq doom-theme 'doom-gruvbox-material) ; dark variant
(setq doom-theme 'doom-gruvbox-material-light) ; light variant

Additionally, I have this function to automatically change the colorscheme depending on the time of the day:

(defun mac/timed-theme (&optional morning-theme night-theme)
  "Change doom-theme depending on time of the day. Runs every hour."
  (let* ((morning-theme (or morning-theme 'doom-solarized-light))
         (night-theme (or night-theme 'doom-solarized-dark))
         (hour (nth 2 (decode-time (current-time))))
         (theme (cond ((<= 7 hour 17)   morning-theme)
                      (t                night-theme))))
    (unless (equal doom-theme theme)
      (setq doom-theme theme)
      (load-theme doom-theme t))
    ;; run every hour
    (run-at-time (format "%02d:%02d" (+ hour 1) 0) nil
                 #'mac/timed-theme morning-theme night-theme)))

(mac/timed-theme 'doom-gruvbox-material-light
                 'doom-gruvbox-material)

Screenshots

All screenshots present the three color palettes with a medium contrast

Dark

Material

Elisp

./img/dark/material_elisp.png

Python

./img/dark/material_python.png

Org-mode

./img/dark/material_org.png

Mix

Elisp

./img/dark/mix_elisp.png

Python

./img/dark/mix_python.png

Org-mode

./img/dark/mix_org.png

Original

Elisp

./img/dark/original_elisp.png

Python

./img/dark/original_python.png

Org-mode

./img/dark/original_org.png

Light

Material

Elisp

./img/light/material_elisp.png

Python

./img/light/material_python.png

Org-mode

./img/light/material_org.png

Mix

Elisp

./img/light/mix_elisp.png

Python

./img/light/mix_python.png

Org-mode

./img/light/mix_org.png

Original

Elisp

./img/light/original_elisp.png

Python

./img/light/original_python.png

Org-mode

./img/light/original_org.png

Your own configuration

Doom allows for extra configuration, which can be achieved by using the custom-theme-set-faces! function. This will give you the ability to customize this color palette to any way you choose, for example:

(custom-theme-set-faces! '(doom-gruvbox-material doom-gruvbox-material-light)
  `(fill-column-indicator :foreground ,(doom-color 'bg-alt)
                          :background ,(doom-color 'bg-alt))
  `(font-lock-comment-face :foreground ,(doom-darken (doom-color 'teal) 0.2))
  `(org-document-info-keyword :foreground ,(doom-darken
                                            (doom-color 'green) 0.3))
  `(org-drawer :foreground ,(doom-darken (doom-color 'yellow) 0.25))
  `(org-link :foreground ,(doom-color 'teal) :underline t)
  `(show-paren-match :foreground ,(doom-color 'fg)
                     :background ,(doom-darken (doom-color 'orange) 0.5))
  `(org-block-begin-line :foreground ,(doom-color 'fg-alt)
                         :background ,(doom-color 'bg-alt))
  `(org-level-1 :foreground ,(doom-color 'violet) :weight bold :height 1.6)
  `(org-level-2 :foreground ,(doom-color 'orange) :weight bold :height 1.4)
  `(org-level-3 :foreground ,(doom-color 'magenta):weight bold  :height 1.2)
  `(org-level-4 :foreground ,(doom-color 'teal) :weight bold :height 1.1))

for more examples, you can always check the documentation ;).