Switch to recommended form of GPLv3 permissions notice.
[bpt/emacs.git] / lisp / org / org-faces.el
CommitLineData
20908596
CD
1;;; org-faces.el --- Face definitions for Org-mode.
2
3;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
4
5;; Author: Carsten Dominik <carsten at orgmode dot org>
6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://orgmode.org
8;; Version: 6.02b
9;;
10;; This file is part of GNU Emacs.
11;;
b1fc2b50 12;; GNU Emacs is free software: you can redistribute it and/or modify
20908596 13;; it under the terms of the GNU General Public License as published by
b1fc2b50
GM
14;; the Free Software Foundation, either version 3 of the License, or
15;; (at your option) any later version.
20908596
CD
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
b1fc2b50 23;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
20908596
CD
24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
25;;
26;;; Commentary:
27
28;; This file contains the face definitons for Org.
29
30;;; Code:
31
32(require 'org-macs)
33(require 'org-compat)
34
35(defgroup org-faces nil
36 "Faces in Org-mode."
37 :tag "Org Faces"
38 :group 'org-font-lock)
39
40(defface org-hide
41 '((((background light)) (:foreground "white"))
42 (((background dark)) (:foreground "black")))
43 "Face used to hide leading stars in headlines.
44The forground color of this face should be equal to the background
45color of the frame."
46 :group 'org-faces)
47
48(defface org-level-1 ;; originally copied from font-lock-function-name-face
49 (org-compatible-face 'outline-1
50 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
51 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
52 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
53 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
54 (((class color) (min-colors 8)) (:foreground "blue" :bold t))
55 (t (:bold t))))
56 "Face used for level 1 headlines."
57 :group 'org-faces)
58
59(defface org-level-2 ;; originally copied from font-lock-variable-name-face
60 (org-compatible-face 'outline-2
61 '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
62 (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
63 (((class color) (min-colors 8) (background light)) (:foreground "yellow"))
64 (((class color) (min-colors 8) (background dark)) (:foreground "yellow" :bold t))
65 (t (:bold t))))
66 "Face used for level 2 headlines."
67 :group 'org-faces)
68
69(defface org-level-3 ;; originally copied from font-lock-keyword-face
70 (org-compatible-face 'outline-3
71 '((((class color) (min-colors 88) (background light)) (:foreground "Purple"))
72 (((class color) (min-colors 88) (background dark)) (:foreground "Cyan1"))
73 (((class color) (min-colors 16) (background light)) (:foreground "Purple"))
74 (((class color) (min-colors 16) (background dark)) (:foreground "Cyan"))
75 (((class color) (min-colors 8) (background light)) (:foreground "purple" :bold t))
76 (((class color) (min-colors 8) (background dark)) (:foreground "cyan" :bold t))
77 (t (:bold t))))
78 "Face used for level 3 headlines."
79 :group 'org-faces)
80
81(defface org-level-4 ;; originally copied from font-lock-comment-face
82 (org-compatible-face 'outline-4
83 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
84 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
85 (((class color) (min-colors 16) (background light)) (:foreground "red"))
86 (((class color) (min-colors 16) (background dark)) (:foreground "red1"))
87 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
88 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
89 (t (:bold t))))
90 "Face used for level 4 headlines."
91 :group 'org-faces)
92
93(defface org-level-5 ;; originally copied from font-lock-type-face
94 (org-compatible-face 'outline-5
95 '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen"))
96 (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen"))
97 (((class color) (min-colors 8)) (:foreground "green"))))
98 "Face used for level 5 headlines."
99 :group 'org-faces)
100
101(defface org-level-6 ;; originally copied from font-lock-constant-face
102 (org-compatible-face 'outline-6
103 '((((class color) (min-colors 16) (background light)) (:foreground "CadetBlue"))
104 (((class color) (min-colors 16) (background dark)) (:foreground "Aquamarine"))
105 (((class color) (min-colors 8)) (:foreground "magenta"))))
106 "Face used for level 6 headlines."
107 :group 'org-faces)
108
109(defface org-level-7 ;; originally copied from font-lock-builtin-face
110 (org-compatible-face 'outline-7
111 '((((class color) (min-colors 16) (background light)) (:foreground "Orchid"))
112 (((class color) (min-colors 16) (background dark)) (:foreground "LightSteelBlue"))
113 (((class color) (min-colors 8)) (:foreground "blue"))))
114 "Face used for level 7 headlines."
115 :group 'org-faces)
116
117(defface org-level-8 ;; originally copied from font-lock-string-face
118 (org-compatible-face 'outline-8
119 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
120 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
121 (((class color) (min-colors 8)) (:foreground "green"))))
122 "Face used for level 8 headlines."
123 :group 'org-faces)
124
125(defface org-special-keyword ;; originally copied from font-lock-string-face
126 (org-compatible-face nil
127 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
128 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
129 (t (:italic t))))
130 "Face used for special keywords."
131 :group 'org-faces)
132
133(defface org-drawer ;; originally copied from font-lock-function-name-face
134 (org-compatible-face nil
135 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
136 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
137 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
138 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
139 (((class color) (min-colors 8)) (:foreground "blue" :bold t))
140 (t (:bold t))))
141 "Face used for drawers."
142 :group 'org-faces)
143
144(defface org-property-value nil
145 "Face used for the value of a property."
146 :group 'org-faces)
147
148(defface org-column
149 (org-compatible-face nil
150 '((((class color) (min-colors 16) (background light))
151 (:background "grey90"))
152 (((class color) (min-colors 16) (background dark))
153 (:background "grey30"))
154 (((class color) (min-colors 8))
155 (:background "cyan" :foreground "black"))
156 (t (:inverse-video t))))
157 "Face for column display of entry properties."
158 :group 'org-faces)
159
160(defface org-column-title
161 (org-compatible-face nil
162 '((((class color) (min-colors 16) (background light))
163 (:background "grey90" :underline t :weight bold))
164 (((class color) (min-colors 16) (background dark))
165 (:background "grey30" :underline t :weight bold))
166 (((class color) (min-colors 8))
167 (:background "cyan" :foreground "black" :underline t :weight bold))
168 (t (:inverse-video t))))
169 "Face for column display of entry properties."
170 :group 'org-faces)
171
172(when (fboundp 'set-face-attribute)
173 ;; Make sure that a fixed-width face is used when we have a column table.
174 (set-face-attribute 'org-column nil
175 :height (face-attribute 'default :height)
176 :family (face-attribute 'default :family)))
177
178(defface org-warning
179 (org-compatible-face 'font-lock-warning-face
180 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
181 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
182 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
183 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
184 (t (:bold t))))
185 "Face for deadlines and TODO keywords."
186 :group 'org-faces)
187
188(defface org-archived ; similar to shadow
189 (org-compatible-face 'shadow
190 '((((class color grayscale) (min-colors 88) (background light))
191 (:foreground "grey50"))
192 (((class color grayscale) (min-colors 88) (background dark))
193 (:foreground "grey70"))
194 (((class color) (min-colors 8) (background light))
195 (:foreground "green"))
196 (((class color) (min-colors 8) (background dark))
197 (:foreground "yellow"))))
198 "Face for headline with the ARCHIVE tag."
199 :group 'org-faces)
200
201(defface org-link
202 '((((class color) (background light)) (:foreground "Purple" :underline t))
203 (((class color) (background dark)) (:foreground "Cyan" :underline t))
204 (t (:underline t)))
205 "Face for links."
206 :group 'org-faces)
207
208(defface org-ellipsis
209 '((((class color) (background light)) (:foreground "DarkGoldenrod" :underline t))
210 (((class color) (background dark)) (:foreground "LightGoldenrod" :underline t))
211 (t (:strike-through t)))
212 "Face for the ellipsis in folded text."
213 :group 'org-faces)
214
215(defface org-target
216 '((((class color) (background light)) (:underline t))
217 (((class color) (background dark)) (:underline t))
218 (t (:underline t)))
219 "Face for links."
220 :group 'org-faces)
221
222(defface org-date
223 '((((class color) (background light)) (:foreground "Purple" :underline t))
224 (((class color) (background dark)) (:foreground "Cyan" :underline t))
225 (t (:underline t)))
226 "Face for links."
227 :group 'org-faces)
228
229(defface org-sexp-date
230 '((((class color) (background light)) (:foreground "Purple"))
231 (((class color) (background dark)) (:foreground "Cyan"))
232 (t (:underline t)))
233 "Face for links."
234 :group 'org-faces)
235
236(defface org-tag
237 '((t (:bold t)))
238 "Face for tags."
239 :group 'org-faces)
240
241(defface org-todo ; font-lock-warning-face
242 (org-compatible-face nil
243 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
244 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
245 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
246 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
247 (t (:inverse-video t :bold t))))
248 "Face for TODO keywords."
249 :group 'org-faces)
250
251(defface org-done ;; originally copied from font-lock-type-face
252 (org-compatible-face nil
253 '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen" :bold t))
254 (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen" :bold t))
255 (((class color) (min-colors 8)) (:foreground "green"))
256 (t (:bold t))))
257 "Face used for todo keywords that indicate DONE items."
258 :group 'org-faces)
259
260(defface org-headline-done ;; originally copied from font-lock-string-face
261 (org-compatible-face nil
262 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
263 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
264 (((class color) (min-colors 8) (background light)) (:bold nil))))
265 "Face used to indicate that a headline is DONE.
266This face is only used if `org-fontify-done-headline' is set. If applies
267to the part of the headline after the DONE keyword."
268 :group 'org-faces)
269
270(defcustom org-todo-keyword-faces nil
271 "Faces for specific TODO keywords.
272This is a list of cons cells, with TODO keywords in the car
273and faces in the cdr. The face can be a symbol, or a property
274list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
275 :group 'org-faces
276 :group 'org-todo
277 :type '(repeat
278 (cons
279 (string :tag "keyword")
280 (sexp :tag "face"))))
281
282(defface org-table ;; originally copied from font-lock-function-name-face
283 (org-compatible-face nil
284 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
285 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
286 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
287 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
288 (((class color) (min-colors 8) (background light)) (:foreground "blue"))
289 (((class color) (min-colors 8) (background dark)))))
290 "Face used for tables."
291 :group 'org-faces)
292
293(defface org-formula
294 (org-compatible-face nil
295 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
296 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
297 (((class color) (min-colors 8) (background light)) (:foreground "red"))
298 (((class color) (min-colors 8) (background dark)) (:foreground "red"))
299 (t (:bold t :italic t))))
300 "Face for formulas."
301 :group 'org-faces)
302
303(defface org-code
304 (org-compatible-face nil
305 '((((class color grayscale) (min-colors 88) (background light))
306 (:foreground "grey50"))
307 (((class color grayscale) (min-colors 88) (background dark))
308 (:foreground "grey70"))
309 (((class color) (min-colors 8) (background light))
310 (:foreground "green"))
311 (((class color) (min-colors 8) (background dark))
312 (:foreground "yellow"))))
313 "Face for fixed-with text like code snippets."
314 :group 'org-faces
315 :version "22.1")
316
317(defface org-verbatim
318 (org-compatible-face nil
319 '((((class color grayscale) (min-colors 88) (background light))
320 (:foreground "grey50" :underline t))
321 (((class color grayscale) (min-colors 88) (background dark))
322 (:foreground "grey70" :underline t))
323 (((class color) (min-colors 8) (background light))
324 (:foreground "green" :underline t))
325 (((class color) (min-colors 8) (background dark))
326 (:foreground "yellow" :underline t))))
327 "Face for fixed-with text like code snippets."
328 :group 'org-faces
329 :version "22.1")
330
331(defface org-agenda-structure ;; originally copied from font-lock-function-name-face
332 (org-compatible-face nil
333 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
334 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
335 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
336 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
337 (((class color) (min-colors 8)) (:foreground "blue" :bold t))
338 (t (:bold t))))
339 "Face used in agenda for captions and dates."
340 :group 'org-faces)
341
342(unless (facep 'org-agenda-date)
343 (copy-face 'org-agenda-structure 'org-agenda-date)
344 (set-face-doc-string 'org-agenda-date
345 "Face used in agenda for normal days."))
346
347(unless (facep 'org-agenda-date-weekend)
348 (copy-face 'org-agenda-date 'org-agenda-date-weekend)
349 (set-face-doc-string 'org-agenda-date-weekend
350 "Face used in agenda for weekend days.
351See the variable `org-agenda-weekend-days' for a definition of which days
352belong to the weekend.")
353 (when (fboundp 'set-face-attribute)
354 (set-face-attribute 'org-agenda-date-weekend nil :weight 'bold)))
355
356(defface org-scheduled-today
357 (org-compatible-face nil
358 '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
359 (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
360 (((class color) (min-colors 8)) (:foreground "green"))
361 (t (:bold t :italic t))))
362 "Face for items scheduled for a certain day."
363 :group 'org-faces)
364
365(defface org-scheduled-previously
366 (org-compatible-face nil
367 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
368 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
369 (((class color) (min-colors 8) (background light)) (:foreground "red"))
370 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
371 (t (:bold t))))
372 "Face for items scheduled previously, and not yet done."
373 :group 'org-faces)
374
375(defface org-upcoming-deadline
376 (org-compatible-face nil
377 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
378 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
379 (((class color) (min-colors 8) (background light)) (:foreground "red"))
380 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
381 (t (:bold t))))
382 "Face for items scheduled previously, and not yet done."
383 :group 'org-faces)
384
385(defcustom org-agenda-deadline-faces
386 '((1.0 . org-warning)
387 (0.5 . org-upcoming-deadline)
388 (0.0 . default))
389 "Faces for showing deadlines in the agenda.
390This is a list of cons cells. The cdr of each cell is a face to be used,
391and it can also just be like '(:foreground \"yellow\").
392Each car is a fraction of the head-warning time that must have passed for
393this the face in the cdr to be used for display. The numbers must be
394given in descending order. The head-warning time is normally taken
395from `org-deadline-warning-days', but can also be specified in the deadline
396timestamp itself, like this:
397
398 DEADLINE: <2007-08-13 Mon -8d>
399
400You may use d for days, w for weeks, m for months and y for years. Months
401and years will only be treated in an approximate fashion (30.4 days for a
402month and 365.24 days for a year)."
403 :group 'org-faces
404 :group 'org-agenda-daily/weekly
405 :type '(repeat
406 (cons
407 (number :tag "Fraction of head-warning time passed")
408 (sexp :tag "Face"))))
409
410(defface org-agenda-restriction-lock
411 (org-compatible-face nil
412 '((((class color) (min-colors 88) (background light)) (:background "yellow1"))
413 (((class color) (min-colors 88) (background dark)) (:background "skyblue4"))
414 (((class color) (min-colors 16) (background light)) (:background "yellow1"))
415 (((class color) (min-colors 16) (background dark)) (:background "skyblue4"))
416 (((class color) (min-colors 8)) (:background "cyan" :foreground "black"))
417 (t (:inverse-video t))))
418 "Face for showing the agenda restriction lock."
419 :group 'org-faces)
420
421(defface org-time-grid ;; originally copied from font-lock-variable-name-face
422 (org-compatible-face nil
423 '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
424 (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
425 (((class color) (min-colors 8)) (:foreground "yellow" :weight light))))
426 "Face used for time grids."
427 :group 'org-faces)
428
429(defconst org-level-faces
430 '(org-level-1 org-level-2 org-level-3 org-level-4
431 org-level-5 org-level-6 org-level-7 org-level-8
432 ))
433
434(defcustom org-n-level-faces (length org-level-faces)
435 "The number of different faces to be used for headlines.
436Org-mode defines 8 different headline faces, so this can be at most 8.
437If it is less than 8, the level-1 face gets re-used for level N+1 etc."
438 :type 'number
439 :group 'org-faces)
440
441(defface org-latex-and-export-specials
442 (let ((font (cond ((assq :inherit custom-face-attributes)
443 '(:inherit underline))
444 (t '(:underline t)))))
445 `((((class grayscale) (background light))
446 (:foreground "DimGray" ,@font))
447 (((class grayscale) (background dark))
448 (:foreground "LightGray" ,@font))
449 (((class color) (background light))
450 (:foreground "SaddleBrown"))
451 (((class color) (background dark))
452 (:foreground "burlywood"))
453 (t (,@font))))
454 "Face used to highlight math latex and other special exporter stuff."
455 :group 'org-faces)
456
457(provide 'org-faces)
458
88ac7b50 459;; arch-tag: 9dab5f91-c4b9-4d6f-bac3-1f6211ad0a04
20908596 460;;; org-faces.el ends here