Emacs: How to Create Your Own Theme

By Xah Lee. Date: .

here's how to create a Color Theme.

create the following file, save it as xah-norm-theme.el

;;; xah-norm-theme.el --- custom theme for faces  -*- lexical-binding:t -*-

;; Copyright (C) 2022 by you.

;; Author: you <your_email_address>

;;; Commentary:

;; a beautiful theme

;;; Code:

(deftheme xah-norm
  "Just a honey background and bold var names.")

(custom-theme-set-faces
 'xah-norm
 '(default ((t (:background "honeydew"))))
 '(font-lock-constant-face ((t (:foreground "black" :bold t))))
 '(font-lock-variable-name-face ((t (:foreground "red" :bold t))))
 ;;
 )

(provide-theme 'xah-norm)

;;; xah-norm-theme.el ends here

put the file at ~/.emacs.d/xah-norm-theme.el

Then, put this in your Emacs Init File:

(load-theme 'xah-norm t)

That's it.

Sample code for builtin theme files at: ~/bin/emacs-28.1/share/emacs/28.1/etc/themes/

also, learn about emacs font face system at:

Emacs Color Theme