From: "Ryan C. Thompson" <rct@thompsonclan.org>
To: org-mode Mailinglist <emacs-orgmode@gnu.org>
Subject: Easier customization of TODO keyword colors
Date: Thu, 03 Sep 2009 22:20:06 -0700 [thread overview]
Message-ID: <4AA0A386.6030901@thompsonclan.org> (raw)
Here is some code I came up with some code to make it easier to
customize the colors of various TODO keywords. As long as you just want
a different color and nothing else, you can customize the variable
org-todo-keyword-faces and use just a string color (i.e. a string of the
color name) as the face, and then org-get-todo-face will convert the
color to a face, inheriting everything else from the standard org-todo face.
To demonstrate, I currently have org-todo-keyword-faces set to
(("IN PROGRESS" . "dark orange")
("WAITING" . "red4")
("CANCELED" . "saddle brown"))
Here's the code, in a form you can put in your .emacs.
(eval-after-load 'org-faces
'(progn
(defcustom org-todo-keyword-faces nil
"Faces for specific TODO keywords.
This is a list of cons cells, with TODO keywords in the car and
faces in the cdr. The face can be a symbol, a color, or a
property list of attributes, like (:foreground \"blue\" :weight
bold :underline t)."
:group 'org-faces
:group 'org-todo
:type '(repeat
(cons
(string :tag "Keyword")
(choice color (sexp :tag "Face")))))))
(eval-after-load 'org
'(progn
(defun org-get-todo-face-from-color (color)
"Returns a specification for a face that inherits from org-todo
face and has the given color as foreground. Returns nil if
color is nil."
(when color
`(:inherit org-warning :foreground ,color)))
(defun org-get-todo-face (kwd)
"Get the right face for a TODO keyword KWD.
If KWD is a number, get the corresponding match group."
(if (numberp kwd) (setq kwd (match-string kwd)))
(or (let ((face (cdr (assoc kwd org-todo-keyword-faces))))
(if (stringp face)
(org-get-todo-face-from-color face)
face))
(and (member kwd org-done-keywords) 'org-done)
'org-todo))))
next reply other threads:[~2009-09-04 5:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-04 5:20 Ryan C. Thompson [this message]
2009-09-04 8:23 ` Easier customization of TODO keyword colors Bastien
2009-09-04 22:17 ` Ryan C. Thompson
2009-09-05 7:06 ` Manish
2010-02-25 16:48 ` Carsten Dominik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AA0A386.6030901@thompsonclan.org \
--to=rct@thompsonclan.org \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).