emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Easier customization of TODO keyword colors
@ 2009-09-04  5:20 Ryan C. Thompson
  2009-09-04  8:23 ` Bastien
  2010-02-25 16:48 ` Carsten Dominik
  0 siblings, 2 replies; 5+ messages in thread
From: Ryan C. Thompson @ 2009-09-04  5:20 UTC (permalink / raw)
  To: org-mode Mailinglist

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))))

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Easier customization of TODO keyword colors
  2009-09-04  5:20 Easier customization of TODO keyword colors Ryan C. Thompson
@ 2009-09-04  8:23 ` Bastien
  2009-09-04 22:17   ` Ryan C. Thompson
  2010-02-25 16:48 ` Carsten Dominik
  1 sibling, 1 reply; 5+ messages in thread
From: Bastien @ 2009-09-04  8:23 UTC (permalink / raw)
  To: Ryan C. Thompson; +Cc: org-mode Mailinglist

"Ryan C. Thompson" <rct@thompsonclan.org> writes:

> 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.

Interesting - would you like to add this in org-hacks?

  http://orgmode.org/worg/org-hacks.php

If so, please send me your username on repo.or.cz (if you are not
already a Worger...)

Thank!

> 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))))
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

-- 
 Bastien

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Easier customization of TODO keyword colors
  2009-09-04  8:23 ` Bastien
@ 2009-09-04 22:17   ` Ryan C. Thompson
  2009-09-05  7:06     ` Manish
  0 siblings, 1 reply; 5+ messages in thread
From: Ryan C. Thompson @ 2009-09-04 22:17 UTC (permalink / raw)
  To: Bastien; +Cc: org-mode Mailinglist

Bastien wrote:
> Interesting - would you like to add this in org-hacks?
>
>   http://orgmode.org/worg/org-hacks.php
>
> If so, please send me your username on repo.or.cz (if you are not
> already a Worger...)
>
> Thank!
>   
I'm not on either, actually. I'm a relative newcomer to org-mode and 
elisp hacking in general. But I'd love to see it on Worg.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Easier customization of TODO keyword colors
  2009-09-04 22:17   ` Ryan C. Thompson
@ 2009-09-05  7:06     ` Manish
  0 siblings, 0 replies; 5+ messages in thread
From: Manish @ 2009-09-05  7:06 UTC (permalink / raw)
  To: Ryan C. Thompson; +Cc: Bastien, org-mode Mailinglist

On Sat, Sep 5, 2009 at 3:47 AM, Ryan C. Thompson wrote:
> Bastien wrote:
>>
>> Interesting - would you like to add this in org-hacks?
>>
>>  http://orgmode.org/worg/org-hacks.php
>>
>> If so, please send me your username on repo.or.cz (if you are not
>> already a Worger...)
>>
>> Thank!
>>
>
> I'm not on either, actually. I'm a relative newcomer to org-mode and elisp
> hacking in general. But I'd love to see it on Worg.

Added that for you.  Should be online in an hour or so.

http://orgmode.org/worg/org-contribute.php

-- 
Manish

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Easier customization of TODO keyword colors
  2009-09-04  5:20 Easier customization of TODO keyword colors Ryan C. Thompson
  2009-09-04  8:23 ` Bastien
@ 2010-02-25 16:48 ` Carsten Dominik
  1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2010-02-25 16:48 UTC (permalink / raw)
  To: Ryan C. Thompson; +Cc: org-mode Mailinglist

Hi Ryan, hu everyone,

this code (an extended version of it) has now been integrated into Org.
It allows you to set fonts for TODO keywords, tags, and priorities in  
this way.
And you can use the variable `org-faces-easy-properties' to make these  
colors specify the background rather tan the foreground color -  
something I like for my TODO keywords.

Thanks Ryan!  Next stop will be using your level indentation cycling  
function.
Just make sure the FSF papers get through.... :-)

- Carsten

On Sep 4, 2009, at 7:20 AM, Ryan C. Thompson wrote:

> 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))))
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-02-25 16:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-04  5:20 Easier customization of TODO keyword colors Ryan C. Thompson
2009-09-04  8:23 ` Bastien
2009-09-04 22:17   ` Ryan C. Thompson
2009-09-05  7:06     ` Manish
2010-02-25 16:48 ` Carsten Dominik

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).