Skip to content

Schievel1/doom-emacs-splash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table Of Contents

License

This work is licensed under Attribution-ShareAlike 4.0 International (CC BY-SA 4.0).

You are free to:

Share — copy and redistribute the material in any medium or format.

Adapt — remix, transform, and build upon the material for any purpose, even commercially.

Under the following terms:

Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.

No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.

Doom

Description

Doom logo using Nord colorscheme and AmazDoom font. Can be used as image as a dashboard image in Doom Emacs (and other Emacs distributions using doom-dashboard) using this code:

;; .doom.d/config.el
(setq fancy-splash-image "/path/to/image/doom.svg")

If you would like to have several logos and a logo to display is chosen by emacs randomly, put the logos in ~/.doom.d/splash. Then use this code:

;; .doom.d/config.el
(let ((alternatives '("nameoffirstfile.svg"
                      "nameofanotherfile.png"
                      "nameofathirdfile.svg")))
  (setq fancy-splash-image
        (concat doom-private-dir "splash/"
                (nth (random (length alternatives)) alternatives))))

You can add or remove the images that can be chosen randomly into alternatives.

Variations

There are also some variations (both vector and raster):

  • doomWithShadow.svg

  • doomEmacs.svg

  • doomEmacsDoomOne.svg

  • doomEmacsDracula.svg

  • doomEmacsGruvbox.svg

  • doomEmacsSolarized.svg

  • doomEmacsRouge.svg

AmazDoom font was used

Make your own

To change to colors of the svg, download the doomEmacs.svg file, get the hexadecimal codes of the colors you want to have and run the following commands to change the colors:

sed -i 's/5e81ac/xxxxxx/g' doomEmacs.svg # top gradient color of the text
sed -i 's/b48ead/xxxxxx/g' doomEmacs.svg # bottom gradient color of the text
sed -i 's/4c566a/xxxxxx/g' doomEmacs.svg # the upper outlines of the 'DOOM' text
sed -i 's/3b4252/xxxxxx/g' doomEmacs.svg # the shadow
sed -i 's/2e3440/xxxxxx/g' doomEmacs.svg # the background
sed -i 's/434c5e/xxxxxx/g' doomEmacs.svg # dot in the middle that the background gradients to

Where xxxxxx is the color you chose.

Or just use really weird bash script :P

Save the script recolor.sh and the file template.svg together into one directory, run recolor.sh:

./recolor.sh nameoftheoutputfile # without a file extension like .svg

The script will ask you for several colors to give as an input. Input the colors as hexadecimal color code without a preceding: 434c5e. It will then spit out a file with the given colors into the directory it is run in.

Make sure to make a pull request to this repo if you created some awesome images for a colorscheme that isn’t added yet. ;-)

Automatically generate in Emacs

Emacs can automatically generate the Doom Emacs logo for you. When ever you switch the color scheme, a new set of images is created and used.

To do this, put the file doom-emacs-splash-template.svg (in the folder svg on this GitHub) into a subfolder splash in your Doom config directory (so usually ~~/.doom.d/splash/~).

The elisp code below is shamelessly stolen from Tecosaur and slightly modified.

(defvar fancy-splash-image-template
  (expand-file-name "splash/doom-emacs-splash-template.svg" doom-private-dir)
  "Default template svg used for the splash image, with substitutions from ")

(defvar fancy-splash-sizes
  `((:height 500 :min-height 50 :padding (0 . 2))
    (:height 450 :min-height 42 :padding (2 . 4))
    (:height 400 :min-height 35 :padding (3 . 3))
    (:height 350 :min-height 28 :padding (3 . 3))
    (:height 200 :min-height 20 :padding (2 . 2))
    (:height 150  :min-height 15 :padding (2 . 1))
    (:height 100  :min-height 13 :padding (2 . 1))
    (:height 75  :min-height 12 :padding (2 . 1))
    (:height 50  :min-height 10 :padding (1 . 0))
    (:height 1   :min-height 0  :padding (0 . 0)))
  "list of plists with the following properties
  :height the height of the image
  :min-height minimum `frame-height' for image
  :padding `+doom-dashboard-banner-padding' (top . bottom) to apply
  :template non-default template file
  :file file to use instead of template")

(defvar fancy-splash-template-colours
  '(("$color1" . functions) ("$color2" . keywords) ("$color3" .  highlight) ("$color4" . bg) ("$color5" . bg) ("$color6" . base0))
  ;; 1: Text up, 2: Text low, 3: upper outlines, 4: shadow, 5: background, 6: gradient to middle
  "list of colour-replacement alists of the form (\"$placeholder\" . 'theme-colour) which applied the template")

(unless (file-exists-p (expand-file-name "theme-splashes" doom-cache-dir))
  (make-directory (expand-file-name "theme-splashes" doom-cache-dir) t))

(defun fancy-splash-filename (theme-name height)
  (expand-file-name (concat (file-name-as-directory "theme-splashes")
                            theme-name
                            "-" (number-to-string height) ".svg")
                    doom-cache-dir))

(defun fancy-splash-clear-cache ()
  "Delete all cached fancy splash images"
  (interactive)
  (delete-directory (expand-file-name "theme-splashes" doom-cache-dir) t)
  (message "Cache cleared!"))

(defun fancy-splash-generate-image (template height)
  "Read TEMPLATE and create an image if HEIGHT with colour substitutions as
   described by `fancy-splash-template-colours' for the current theme"
  (with-temp-buffer
    (insert-file-contents template)
    (re-search-forward "$height" nil t)
    (replace-match (number-to-string height) nil nil)
    (replace-match (number-to-string height) nil nil)
    (dolist (substitution fancy-splash-template-colours)
      (goto-char (point-min))
      (while (re-search-forward (car substitution) nil t)
        (replace-match (doom-color (cdr substitution)) nil nil)))
    (write-region nil nil
                  (fancy-splash-filename (symbol-name doom-theme) height) nil nil)))

(defun fancy-splash-generate-images ()
  "Perform `fancy-splash-generate-image' in bulk"
  (dolist (size fancy-splash-sizes)
    (unless (plist-get size :file)
      (fancy-splash-generate-image (or (plist-get size :template)
                                       fancy-splash-image-template)
                                   (plist-get size :height)))))

(defun ensure-theme-splash-images-exist (&optional height)
  (unless (file-exists-p (fancy-splash-filename
                          (symbol-name doom-theme)
                          (or height
                              (plist-get (car fancy-splash-sizes) :height))))
    (fancy-splash-generate-images)))

(defun get-appropriate-splash ()
  (let ((height (frame-height)))
    (cl-some (lambda (size) (when (>= height (plist-get size :min-height)) size))
             fancy-splash-sizes)))

(setq fancy-splash-last-size nil)
(setq fancy-splash-last-theme nil)
(defun set-appropriate-splash (&rest _)
  (let ((appropriate-image (get-appropriate-splash)))
    (unless (and (equal appropriate-image fancy-splash-last-size)
                 (equal doom-theme fancy-splash-last-theme)))
    (unless (plist-get appropriate-image :file)
      (ensure-theme-splash-images-exist (plist-get appropriate-image :height)))
    (setq fancy-splash-image
          (or (plist-get appropriate-image :file)
              (fancy-splash-filename (symbol-name doom-theme) (plist-get appropriate-image :height))))
    (setq +doom-dashboard-banner-padding (plist-get appropriate-image :padding))
    (setq fancy-splash-last-size appropriate-image)
    (setq fancy-splash-last-theme doom-theme)
    (+doom-dashboard-reload)))

(add-hook 'window-size-change-functions #'set-appropriate-splash)
(add-hook 'doom-load-theme-hook #'set-appropriate-splash)

Look in your theme what the different colors are called. If you want to use a different color, but still want to keep the automatic generation, you can change the line:

'(("$color1" . functions) ("$color2" . keywords) ("$color3" .  highlight) ("$color4" . bg) ("$color5" . bg) ("$color6" . base0))

This snippet above automatically generates a set of images and puts them into your Emacs’ temp folder. So it does not always generate new images every time you start up Emacs. If you changed some of the colors and want to generate new images, use M-x fancy-splash-clear-cache.

GNU Emacs

Description

Emacs logo, inspired and based on Papirus icon theme. Like Doom, also can be used as a dashboard image.

Inspired and based on Papirus