

stefan-theme-tangle.org
source link: https://gitlab.com/stefan.koch.micro/dotfiles/-/blob/master/emacs/stefan-theme-tangle.org
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Literate Emacs Color Theme Organized by Functionality
Theme File
This file sill generate the .emacs.d/stefan-theme.el
files on tangling. It uses org tangle and noweb to collect the various parts of the theme files into a single theme file. The advantage of using noweb is that the content can be organized by functionality and the noweb will rearrange it into the sequential sections needed by the theme definition file.
The theme itself is not complete, nor do I have a great artistic style, but it works for me. The value of this file/code is more to serve as an example for how to organize an Emacs theme by using noweb to group by functionality instead of by the requirements needed for the theme elisp format.
The theme file uses autothemer
based on System Crafters youtube video Emacs Tips - How to Create Your Own Color Theme. The sections below fill in the body of the theme. Specifically each section below will add content to the <<xxxx>>
sections in the file below. Note that the source blocks below will have the :noweb-ref <<xxxx>>
header argument. That is how the body of the theme file is filled in.
(require 'autothemer) <<stefan-defface>> (autothemer-deftheme stefan "Stefan's own personal theme" ((((class color) (min-colors #xFFFFFF))) <<stefan-colors>> ) ( <<stefan-faces>> )) (custom-theme-set-variables 'stefan <<stefan-variables>> ) (provide-theme 'stefan)
To load the theme: (load-theme 'stefan t)
Useful lisp functions for creating themes:
-
describe-face
: Show the face that is active for the current cursor position. -
list-faces-display
: Show a buffer with the known faces -
list-colors-display
: show a buffer with the named colors.
General Setup
Colors
Set some color names that can be used across the modes.
(stefan-default "white") (stefan-dim "DimGray") (stefan-constant "Aquamarine")
Global Faces
Set the default, cursor and selection/active region colors.
(default (:foreground stefan-default :background "black" )) (cursor (:background stefan-default)) (region (:background "gray40"))
Org Mode
Headings
Set the main headings to be larger, but with a subdued color. That way the text stands out, but the heading level is visible.
(stefan-outline-1 "OliveDrab") (stefan-outline-2 "ForestGreen") (stefan-outline-3 "SeaGreen") (stefan-outline-4 "DarkOliveGreen")
(org-level-1 (:foreground stefan-outline-1 :height 1.50)) (org-level-2 (:foreground stefan-outline-2 :height 1.33)) (org-level-3 (:foreground stefan-outline-3 :height 1.16)) (org-level-4 (:foreground stefan-outline-4 )) (org-level-5 (:foreground stefan-outline-4 )) (org-level-6 (:foreground stefan-outline-4 )) (org-level-7 (:foreground stefan-outline-4 )) (org-level-8 (:foreground stefan-outline-4 ))
Since the above (and indent) makes the level apparent enough, don’t show Leading stars.
'(org-hide-leading-stars nil)
Todo Highlights
Todo keywords are split into active, waiting and future buckets.
This setup the faces for these.
(defface stefan-org-todo-active '() "TODO keywords that I can work on now.") (defface stefan-org-todo-wait '() "TODO keywords where I am waiting") (defface stefan-org-todo-future '() "Completed TODO keywords that are future reminders.")
Assign the names of the todo keywords into the buckets.
'(org-todo-keyword-faces '(("WAIT" . stefan-org-todo-wait) ("WAIT_OTHER" . stefan-org-todo-wait) ("TODO" . stefan-org-todo-active) ("PLAN" . stefan-org-todo-future) ("READING" . stefan-org-todo-future)))
Finally assign the colors to the todo keywords. Also set the whole headline to dim when it is done.
(stefan-org-todo-active (:foreground "coral" :weight 'bold)) (stefan-org-todo-wait (:foreground "chocolate" :weight 'bold)) (stefan-org-todo-future (:foreground "SaddleBrown" :weight 'bold)) (stefan-org-todo-done (:foreground stefan-dim :weight 'bold)) (org-todo (:foreground "red" :weight 'bold)) (org-done (:foreground stefan-dim)) (org-headline-done (:foreground stefan-dim))
I want to define a special face to highlight special tags.
(defface stefan-org-tag-context '() "Tags that indicate context of the activity.")
Assign the colors to the faces:
(stefan-org-tag-context (:foreground "orange"))
Body Faces
(org-link (:foreground "LightSteelBlue" :underline t)) (org-date (:foreground "LightSteelBlue" :underline t)) (org-priority (:foreground "DarkRed")) (org-code (:inherit 'fixed-pitch :foreground "SkyBlue" :underline nil)) (org-verbatim (:inherit 'fixed-pitch :foreground stefan-constant ))
Variable Pitch Org Mode.
Set tables and source blocks to be fixed width even if the rest of org mode is not.
(org-table (:inherit 'fixed-pitch)) (org-block (:inherit 'fixed-pitch))
HC-Highlight (whitespace)
Set the white space indications/errors to be subtle.
(hc-tab (:background "gray20")) (hc-trailing-whitespace (:background "gray20"))
Programming modes
Make comments and python doc-strings the same subtle color.
(font-lock-comment-face (:foreground stefan-dim)) (font-lock-doc-face (:foreground stefan-dim))
Recommend
-
111
JS web frameworks benchmark – Round 7 Posted on November 20, 2017 This is the 2017 Pre-Ch...
-
32
Stefan Tilkov在microXchg柏林的演讲:微服务的模式与反模式
-
35
超级白菜:Tangle Teezer 经典便携梳子 多色可选 无盖 19元包邮含税,来自什么值得买甄选出的唯品会优惠产品,汇聚数十万什么值得买网友对该网购产品的点评。
-
46
-
68
A collection of tools for restricted org-mode in rust. - parsing-tech/org-rs
-
16
My PhpStorm settings after 8 years of use Published on January 15th, 2020 It's been a long time. I've been using PhpStorm for almost 8 years now. Mo...
-
5
org-mode根据不同条件tangle不同代码块 原来org-mode中代码块的参数可以是一段elisp代码,这个特性可以让我们动态tangle不同代码块,像这样(代码摘自h...
-
6
No hard feelings: Amos and Jewett tangle, finish togetherBy PAT GRAHAMAugust 1, 2021
-
6
Wrangling the Tangle of Apple Cables and Dongles Since Steve Job’s return in 1997, Apple has been bold about drop...
-
6
Love and terrorism tangle in French-English Liaison trailer
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK