Sync copyright fixes from downstream Emacs
[org-mode.git] / lisp / org-faces.el
blobe07102f9a54a436b4c646909158e5a2cd077ff76
1 ;;; org-faces.el --- Face definitions for Org-mode.
3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
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.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
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.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26 ;;; Commentary:
28 ;; This file contains the face definitons for Org.
30 ;;; Code:
32 (require 'org-macs)
33 (require 'org-compat)
35 (defgroup org-faces nil
36 "Faces in Org-mode."
37 :tag "Org Faces"
38 :group 'org-font-lock)
40 (defface org-hide
41 '((((background light)) (:foreground "white"))
42 (((background dark)) (:foreground "black")))
43 "Face used to hide leading stars in headlines.
44 The forground color of this face should be equal to the background
45 color of the frame."
46 :group 'org-faces)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
144 (defface org-property-value nil
145 "Face used for the value of a property."
146 :group 'org-faces)
148 (defface org-column
149 (org-compatible-face nil
150 '((((class color) (min-colors 16) (background light))
151 (:background "grey90" :weight normal :strike-through nil :underline nil))
152 (((class color) (min-colors 16) (background dark))
153 (:background "grey30" :weight normal :strike-through nil :underline nil))
154 (((class color) (min-colors 8))
155 (:background "cyan" :foreground "black"
156 :weight normal :strike-through nil :underline nil))
157 (t (:inverse-video t))))
158 "Face for column display of entry properties."
159 :group 'org-faces)
161 (defface org-column-title
162 (org-compatible-face nil
163 '((((class color) (min-colors 16) (background light))
164 (:background "grey90" :underline t :weight bold))
165 (((class color) (min-colors 16) (background dark))
166 (:background "grey30" :underline t :weight bold))
167 (((class color) (min-colors 8))
168 (:background "cyan" :foreground "black" :underline t :weight bold))
169 (t (:inverse-video t))))
170 "Face for column display of entry properties."
171 :group 'org-faces)
173 (when (fboundp 'set-face-attribute)
174 ;; Make sure that a fixed-width face is used when we have a column table.
175 (set-face-attribute 'org-column nil
176 :height (face-attribute 'default :height)
177 :family (face-attribute 'default :family)))
179 (defface org-warning
180 (org-compatible-face 'font-lock-warning-face
181 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
182 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
183 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
184 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
185 (t (:bold t))))
186 "Face for deadlines and TODO keywords."
187 :group 'org-faces)
189 (defface org-archived ; similar to shadow
190 (org-compatible-face 'shadow
191 '((((class color grayscale) (min-colors 88) (background light))
192 (:foreground "grey50"))
193 (((class color grayscale) (min-colors 88) (background dark))
194 (:foreground "grey70"))
195 (((class color) (min-colors 8) (background light))
196 (:foreground "green"))
197 (((class color) (min-colors 8) (background dark))
198 (:foreground "yellow"))))
199 "Face for headline with the ARCHIVE tag."
200 :group 'org-faces)
202 (defface org-link
203 '((((class color) (background light)) (:foreground "Purple" :underline t))
204 (((class color) (background dark)) (:foreground "Cyan" :underline t))
205 (t (:underline t)))
206 "Face for links."
207 :group 'org-faces)
209 (defface org-ellipsis
210 '((((class color) (background light)) (:foreground "DarkGoldenrod" :underline t))
211 (((class color) (background dark)) (:foreground "LightGoldenrod" :underline t))
212 (t (:strike-through t)))
213 "Face for the ellipsis in folded text."
214 :group 'org-faces)
216 (defface org-target
217 '((((class color) (background light)) (:underline t))
218 (((class color) (background dark)) (:underline t))
219 (t (:underline t)))
220 "Face for links."
221 :group 'org-faces)
223 (defface org-date
224 '((((class color) (background light)) (:foreground "Purple" :underline t))
225 (((class color) (background dark)) (:foreground "Cyan" :underline t))
226 (t (:underline t)))
227 "Face for links."
228 :group 'org-faces)
230 (defface org-sexp-date
231 '((((class color) (background light)) (:foreground "Purple"))
232 (((class color) (background dark)) (:foreground "Cyan"))
233 (t (:underline t)))
234 "Face for links."
235 :group 'org-faces)
237 (defface org-tag
238 '((t (:bold t)))
239 "Face for tags."
240 :group 'org-faces)
242 (defface org-todo ; font-lock-warning-face
243 (org-compatible-face nil
244 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
245 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
246 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
247 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
248 (t (:inverse-video t :bold t))))
249 "Face for TODO keywords."
250 :group 'org-faces)
252 (defface org-done ;; originally copied from font-lock-type-face
253 (org-compatible-face nil
254 '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen" :bold t))
255 (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen" :bold t))
256 (((class color) (min-colors 8)) (:foreground "green"))
257 (t (:bold t))))
258 "Face used for todo keywords that indicate DONE items."
259 :group 'org-faces)
261 (defface org-headline-done ;; originally copied from font-lock-string-face
262 (org-compatible-face nil
263 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
264 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
265 (((class color) (min-colors 8) (background light)) (:bold nil))))
266 "Face used to indicate that a headline is DONE.
267 This face is only used if `org-fontify-done-headline' is set. If applies
268 to the part of the headline after the DONE keyword."
269 :group 'org-faces)
271 (defcustom org-todo-keyword-faces nil
272 "Faces for specific TODO keywords.
273 This is a list of cons cells, with TODO keywords in the car
274 and faces in the cdr. The face can be a symbol, or a property
275 list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
276 :group 'org-faces
277 :group 'org-todo
278 :type '(repeat
279 (cons
280 (string :tag "keyword")
281 (sexp :tag "face"))))
283 (defface org-table ;; originally copied from font-lock-function-name-face
284 (org-compatible-face nil
285 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
286 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
287 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
288 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
289 (((class color) (min-colors 8) (background light)) (:foreground "blue"))
290 (((class color) (min-colors 8) (background dark)))))
291 "Face used for tables."
292 :group 'org-faces)
294 (defface org-formula
295 (org-compatible-face nil
296 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
297 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
298 (((class color) (min-colors 8) (background light)) (:foreground "red"))
299 (((class color) (min-colors 8) (background dark)) (:foreground "red"))
300 (t (:bold t :italic t))))
301 "Face for formulas."
302 :group 'org-faces)
304 (defface org-code
305 (org-compatible-face nil
306 '((((class color grayscale) (min-colors 88) (background light))
307 (:foreground "grey50"))
308 (((class color grayscale) (min-colors 88) (background dark))
309 (:foreground "grey70"))
310 (((class color) (min-colors 8) (background light))
311 (:foreground "green"))
312 (((class color) (min-colors 8) (background dark))
313 (:foreground "yellow"))))
314 "Face for fixed-with text like code snippets."
315 :group 'org-faces
316 :version "22.1")
318 (defface org-verbatim
319 (org-compatible-face nil
320 '((((class color grayscale) (min-colors 88) (background light))
321 (:foreground "grey50" :underline t))
322 (((class color grayscale) (min-colors 88) (background dark))
323 (:foreground "grey70" :underline t))
324 (((class color) (min-colors 8) (background light))
325 (:foreground "green" :underline t))
326 (((class color) (min-colors 8) (background dark))
327 (:foreground "yellow" :underline t))))
328 "Face for fixed-with text like code snippets."
329 :group 'org-faces
330 :version "22.1")
332 (defface org-agenda-structure ;; originally copied from font-lock-function-name-face
333 (org-compatible-face nil
334 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
335 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
336 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
337 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
338 (((class color) (min-colors 8)) (:foreground "blue" :bold t))
339 (t (:bold t))))
340 "Face used in agenda for captions and dates."
341 :group 'org-faces)
343 (unless (facep 'org-agenda-date)
344 (copy-face 'org-agenda-structure 'org-agenda-date)
345 (set-face-doc-string 'org-agenda-date
346 "Face used in agenda for normal days."))
348 (unless (facep 'org-agenda-date-weekend)
349 (copy-face 'org-agenda-date 'org-agenda-date-weekend)
350 (set-face-doc-string 'org-agenda-date-weekend
351 "Face used in agenda for weekend days.
352 See the variable `org-agenda-weekend-days' for a definition of which days
353 belong to the weekend.")
354 (when (fboundp 'set-face-attribute)
355 (set-face-attribute 'org-agenda-date-weekend nil :weight 'bold)))
357 (defface org-scheduled-today
358 (org-compatible-face nil
359 '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
360 (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
361 (((class color) (min-colors 8)) (:foreground "green"))
362 (t (:bold t :italic t))))
363 "Face for items scheduled for a certain day."
364 :group 'org-faces)
366 (defface org-scheduled-previously
367 (org-compatible-face nil
368 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
369 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
370 (((class color) (min-colors 8) (background light)) (:foreground "red"))
371 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
372 (t (:bold t))))
373 "Face for items scheduled previously, and not yet done."
374 :group 'org-faces)
376 (defface org-upcoming-deadline
377 (org-compatible-face nil
378 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
379 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
380 (((class color) (min-colors 8) (background light)) (:foreground "red"))
381 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
382 (t (:bold t))))
383 "Face for items scheduled previously, and not yet done."
384 :group 'org-faces)
386 (defcustom org-agenda-deadline-faces
387 '((1.0 . org-warning)
388 (0.5 . org-upcoming-deadline)
389 (0.0 . default))
390 "Faces for showing deadlines in the agenda.
391 This is a list of cons cells. The cdr of each cell is a face to be used,
392 and it can also just be like '(:foreground \"yellow\").
393 Each car is a fraction of the head-warning time that must have passed for
394 this the face in the cdr to be used for display. The numbers must be
395 given in descending order. The head-warning time is normally taken
396 from `org-deadline-warning-days', but can also be specified in the deadline
397 timestamp itself, like this:
399 DEADLINE: <2007-08-13 Mon -8d>
401 You may use d for days, w for weeks, m for months and y for years. Months
402 and years will only be treated in an approximate fashion (30.4 days for a
403 month and 365.24 days for a year)."
404 :group 'org-faces
405 :group 'org-agenda-daily/weekly
406 :type '(repeat
407 (cons
408 (number :tag "Fraction of head-warning time passed")
409 (sexp :tag "Face"))))
411 (defface org-agenda-restriction-lock
412 (org-compatible-face nil
413 '((((class color) (min-colors 88) (background light)) (:background "yellow1"))
414 (((class color) (min-colors 88) (background dark)) (:background "skyblue4"))
415 (((class color) (min-colors 16) (background light)) (:background "yellow1"))
416 (((class color) (min-colors 16) (background dark)) (:background "skyblue4"))
417 (((class color) (min-colors 8)) (:background "cyan" :foreground "black"))
418 (t (:inverse-video t))))
419 "Face for showing the agenda restriction lock."
420 :group 'org-faces)
422 (defface org-time-grid ;; originally copied from font-lock-variable-name-face
423 (org-compatible-face nil
424 '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
425 (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
426 (((class color) (min-colors 8)) (:foreground "yellow" :weight light))))
427 "Face used for time grids."
428 :group 'org-faces)
430 (defconst org-level-faces
431 '(org-level-1 org-level-2 org-level-3 org-level-4
432 org-level-5 org-level-6 org-level-7 org-level-8
435 (defcustom org-n-level-faces (length org-level-faces)
436 "The number of different faces to be used for headlines.
437 Org-mode defines 8 different headline faces, so this can be at most 8.
438 If it is less than 8, the level-1 face gets re-used for level N+1 etc."
439 :type 'number
440 :group 'org-faces)
442 (defface org-latex-and-export-specials
443 (let ((font (cond ((assq :inherit custom-face-attributes)
444 '(:inherit underline))
445 (t '(:underline t)))))
446 `((((class grayscale) (background light))
447 (:foreground "DimGray" ,@font))
448 (((class grayscale) (background dark))
449 (:foreground "LightGray" ,@font))
450 (((class color) (background light))
451 (:foreground "SaddleBrown"))
452 (((class color) (background dark))
453 (:foreground "burlywood"))
454 (t (,@font))))
455 "Face used to highlight math latex and other special exporter stuff."
456 :group 'org-faces)
458 (provide 'org-faces)
460 ;; arch-tag: 9dab5f91-c4b9-4d6f-bac3-1f6211ad0a04
462 ;;; org-faces.el ends here