initial commit
[emacs-init.git] / auto-install / icicles-face.el
1 ;;; icicles-face.el --- Faces for Icicles
2 ;;
3 ;; Filename: icicles-face.el
4 ;; Description: Faces for Icicles
5 ;; Author: Drew Adams
6 ;; Maintainer: Drew Adams
7 ;; Copyright (C) 1996-2011, Drew Adams, all rights reserved.
8 ;; Created: Mon Feb 27 09:19:43 2006
9 ;; Version: 22.0
10 ;; Last-Updated: Tue Aug 16 16:21:58 2011 (-0700)
11 ;;           By: dradams
12 ;;     Update #: 574
13 ;; URL: http://www.emacswiki.org/cgi-bin/wiki/icicles-face.el
14 ;; Keywords: internal, extensions, help, abbrev, local, minibuffer,
15 ;;           keys, apropos, completion, matching, regexp, command
16 ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x
17 ;;
18 ;; Features that might be required by this library:
19 ;;
20 ;;   None
21 ;;
22 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
23 ;;
24 ;;; Commentary:
25 ;;
26 ;;  This is a helper library for library `icicles.el'.  It defines
27 ;;  customization groups and faces.  For Icicles documentation, see
28 ;;  `icicles-doc1.el' and `icicles-doc2.el'.
29 ;;
30 ;;  Groups defined here:
31 ;;
32 ;;    `Icicles', `Icicles-Buffers', `Icicles-Completions-Display',
33 ;;    `Icicles-Files', `Icicles-Key-Bindings',
34 ;;    `Icicles-Key-Completion', `Icicles-Matching',
35 ;;    `Icicles-Minibuffer-Display', `Icicles-Miscellaneous',
36 ;;    `Icicles-Searching'.
37 ;;
38 ;;  Faces defined here:
39 ;;
40 ;;    `icicle-candidate-part',
41 ;;    `icicle-common-match-highlight-Completions',
42 ;;    `icicle-complete-input', `icicle-completion',
43 ;;    `icicle-Completions-instruction-1',
44 ;;    `icicle-Completions-instruction-2',
45 ;;    `icicle-current-candidate-highlight', `icicle-extra-candidate',
46 ;;    `icicle-historical-candidate', `icicle-input-completion-fail',
47 ;;    `icicle-input-completion-fail-lax',
48 ;;    `icicle-match-highlight-Completions',
49 ;;    `icicle-match-highlight-minibuffer', `icicle-mode-line-help',
50 ;;    `icicle-multi-command-completion',
51 ;;    `icicle-mustmatch-completion', `icicle-proxy-candidate',
52 ;;    `icicle-saved-candidate', `icicle-search-context-level-1',
53 ;;    `icicle-search-context-level-2',
54 ;;    `icicle-search-context-level-3',
55 ;;    `icicle-search-context-level-4',
56 ;;    `icicle-search-context-level-5',
57 ;;    `icicle-search-context-level-6',
58 ;;    `icicle-search-context-level-7',
59 ;;    `icicle-search-context-level-8', `icicle-search-current-input',
60 ;;    `icicle-search-main-regexp-current',
61 ;;    `icicle-search-main-regexp-others', `icicle-special-candidate',
62 ;;    `icicle-whitespace-highlight', `minibuffer-prompt'.
63 ;;
64 ;;  Functions defined here:
65 ;;
66 ;;    `icicle-increment-color-hue',
67 ;;    `icicle-increment-color-saturation'
68 ;;    `icicle-increment-color-value'.
69 ;;
70 ;;  For descriptions of changes to this file, see `icicles-chg.el'.
71  
72 ;;(@> "Index")
73 ;;
74 ;;  If you have library `linkd.el' and Emacs 22 or later, load
75 ;;  `linkd.el' and turn on `linkd-mode' now.  It lets you easily
76 ;;  navigate around the sections of this doc.  Linkd mode will
77 ;;  highlight this Index, as well as the cross-references and section
78 ;;  headings throughout this file.  You can get `linkd.el' here:
79 ;;  http://dto.freeshell.org/notebook/Linkd.html.
80 ;;
81 ;;  (@> "Groups, organized alphabetically")
82 ;;  (@> "Faces, organized alphabetically")
83  
84 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
85 ;;
86 ;; This program is free software; you can redistribute it and/or modify
87 ;; it under the terms of the GNU General Public License as published by
88 ;; the Free Software Foundation; either version 2, or (at your option)
89 ;; any later version.
90 ;;
91 ;; This program is distributed in the hope that it will be useful,
92 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
93 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
94 ;; GNU General Public License for more details.
95 ;;
96 ;; You should have received a copy of the GNU General Public License
97 ;; along with this program; see the file COPYING.  If not, write to the
98 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth
99 ;; ;; Floor, Boston, MA 02110-1301, USA.
100 ;;
101 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
102 ;;
103 ;;; Code:
104
105 (eval-when-compile (require 'hexrgb nil t)) ;; (no error if not found):
106   ;; hexrgb-color-values-to-hex, hexrgb-hsv-to-rgb, hexrgb-rgb-to-hsv.
107
108 (require 'icicles-mac) ;; icicle-maybe-byte-compile-after-load
109
110 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
111  
112 ;;(@* "Groups, organized alphabetically")
113
114 ;;; Groups, organized alphabetically ---------------------------------
115
116 ;;;###autoload
117 (defgroup Icicles nil
118   "Minibuffer input completion and cycling of completion candidates."
119   :prefix "icicle-"
120   :group 'completion :group 'convenience :group 'help :group 'apropos
121   :group 'dabbrev :group 'matching :group 'minibuffer :group 'recentf
122   :link `(url-link :tag "Send Bug Report"
123           ,(concat "mailto:" "drew.adams" "@" "oracle"
124                    ".com?subject=icicles.el bug: \
125 &body=Describe bug here, starting with `emacs -q'.  \
126 Don't forget to mention your Emacs and Icicles library versions."))
127   :link '(url-link :tag "Other Libraries by Drew"
128           "http://www.emacswiki.org/cgi-bin/wiki/DrewsElispLibraries")
129   :link '(url-link :tag "Download"
130           "http://www.emacswiki.org/cgi-bin/wiki/icicles.el")
131   :link '(url-link :tag "Description"
132           "http://www.emacswiki.org/cgi-bin/wiki/Icicles")
133   :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2")
134   :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1")
135   )
136
137 ;;;###autoload
138 (defgroup Icicles-Buffers nil
139   "Icicles preferences related to buffers."
140   :prefix "icicle-" :group 'Icicles
141   :link `(url-link :tag "Send Bug Report"
142           ,(concat "mailto:" "drew.adams" "@" "oracle"
143                    ".com?subject=icicles.el bug: \
144 &body=Describe bug here, starting with `emacs -q'.  \
145 Don't forget to mention your Emacs and Icicles library versions."))
146   :link '(url-link :tag "Other Libraries by Drew"
147           "http://www.emacswiki.org/cgi-bin/wiki/DrewsElispLibraries")
148   :link '(url-link :tag "Download"
149           "http://www.emacswiki.org/cgi-bin/wiki/icicles.el")
150   :link '(url-link :tag "Description"
151           "http://www.emacswiki.org/cgi-bin/wiki/Icicles")
152   :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2")
153   :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1")
154   )
155
156 ;;;###autoload
157 (defgroup Icicles-Files nil
158   "Icicles preferences related to files."
159   :prefix "icicle-" :group 'Icicles
160   :link `(url-link :tag "Send Bug Report"
161           ,(concat "mailto:" "drew.adams" "@" "oracle"
162                    ".com?subject=icicles.el bug: \
163 &body=Describe bug here, starting with `emacs -q'.  \
164 Don't forget to mention your Emacs and Icicles library versions."))
165   :link '(url-link :tag "Other Libraries by Drew"
166           "http://www.emacswiki.org/cgi-bin/wiki/DrewsElispLibraries")
167   :link '(url-link :tag "Download"
168           "http://www.emacswiki.org/cgi-bin/wiki/icicles.el")
169   :link '(url-link :tag "Description"
170           "http://www.emacswiki.org/cgi-bin/wiki/Icicles")
171   :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2")
172   :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1")
173   )
174
175 ;;;###autoload
176 (defgroup Icicles-Completions-Display nil
177   "Icicles preferences related to display of completion candidates."
178   :prefix "icicle-" :group 'Icicles
179   :link `(url-link :tag "Send Bug Report"
180           ,(concat "mailto:" "drew.adams" "@" "oracle"
181                    ".com?subject=icicles.el bug: \
182 &body=Describe bug here, starting with `emacs -q'.  \
183 Don't forget to mention your Emacs and Icicles library versions."))
184   :link '(url-link :tag "Other Libraries by Drew"
185           "http://www.emacswiki.org/cgi-bin/wiki/DrewsElispLibraries")
186   :link '(url-link :tag "Download"
187           "http://www.emacswiki.org/cgi-bin/wiki/icicles.el")
188   :link '(url-link :tag "Description"
189           "http://www.emacswiki.org/cgi-bin/wiki/Icicles")
190   :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2")
191   :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1")
192   )
193
194 ;;;###autoload
195 (defgroup Icicles-Key-Bindings nil
196   "Icicles preferences related to key bindings."
197   :prefix "icicle-" :group 'Icicles
198   :link `(url-link :tag "Send Bug Report"
199           ,(concat "mailto:" "drew.adams" "@" "oracle"
200                    ".com?subject=icicles.el bug: \
201 &body=Describe bug here, starting with `emacs -q'.  \
202 Don't forget to mention your Emacs and Icicles library versions."))
203   :link '(url-link :tag "Other Libraries by Drew"
204           "http://www.emacswiki.org/cgi-bin/wiki/DrewsElispLibraries")
205   :link '(url-link :tag "Download"
206           "http://www.emacswiki.org/cgi-bin/wiki/icicles.el")
207   :link '(url-link :tag "Description"
208           "http://www.emacswiki.org/cgi-bin/wiki/Icicles")
209   :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2")
210   :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1")
211   )
212
213 ;;;###autoload
214 (defgroup Icicles-Key-Completion nil
215   "Icicles preferences related to key completion (`icicle-complete-keys')."
216   :prefix "icicle-" :group 'Icicles
217   :link `(url-link :tag "Send Bug Report"
218           ,(concat "mailto:" "drew.adams" "@" "oracle"
219                    ".com?subject=icicles.el bug: \
220 &body=Describe bug here, starting with `emacs -q'.  \
221 Don't forget to mention your Emacs and Icicles library versions."))
222   :link '(url-link :tag "Other Libraries by Drew"
223           "http://www.emacswiki.org/cgi-bin/wiki/DrewsElispLibraries")
224   :link '(url-link :tag "Download"
225           "http://www.emacswiki.org/cgi-bin/wiki/icicles.el")
226   :link '(url-link :tag "Description"
227           "http://www.emacswiki.org/cgi-bin/wiki/Icicles")
228   :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2")
229   :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1")
230   )
231
232 ;;;###autoload
233 (defgroup Icicles-Matching nil
234   "Icicles preferences related to matching input for completion."
235   :prefix "icicle-" :group 'Icicles
236   :link `(url-link :tag "Send Bug Report"
237           ,(concat "mailto:" "drew.adams" "@" "oracle"
238                    ".com?subject=icicles.el bug: \
239 &body=Describe bug here, starting with `emacs -q'.  \
240 Don't forget to mention your Emacs and Icicles library versions."))
241   :link '(url-link :tag "Other Libraries by Drew"
242           "http://www.emacswiki.org/cgi-bin/wiki/DrewsElispLibraries")
243   :link '(url-link :tag "Download"
244           "http://www.emacswiki.org/cgi-bin/wiki/icicles.el")
245   :link '(url-link :tag "Description"
246           "http://www.emacswiki.org/cgi-bin/wiki/Icicles")
247   :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2")
248   :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1")
249   )
250
251 ;;;###autoload
252 (defgroup Icicles-Minibuffer-Display nil
253   "Icicles preferences related to minibuffer display during completion."
254   :prefix "icicle-" :group 'Icicles
255   :link `(url-link :tag "Send Bug Report"
256           ,(concat "mailto:" "drew.adams" "@" "oracle"
257                    ".com?subject=icicles.el bug: \
258 &body=Describe bug here, starting with `emacs -q'.  \
259 Don't forget to mention your Emacs and Icicles library versions."))
260   :link '(url-link :tag "Other Libraries by Drew"
261           "http://www.emacswiki.org/cgi-bin/wiki/DrewsElispLibraries")
262   :link '(url-link :tag "Download"
263           "http://www.emacswiki.org/cgi-bin/wiki/icicles.el")
264   :link '(url-link :tag "Description"
265           "http://www.emacswiki.org/cgi-bin/wiki/Icicles")
266   :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2")
267   :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1")
268   )
269
270 ;;;###autoload
271 (defgroup Icicles-Miscellaneous nil
272   "Miscellaneous Icicles preferences."
273   :prefix "icicle-" :group 'Icicles
274   :link `(url-link :tag "Send Bug Report"
275           ,(concat "mailto:" "drew.adams" "@" "oracle"
276                    ".com?subject=icicles.el bug: \
277 &body=Describe bug here, starting with `emacs -q'.  \
278 Don't forget to mention your Emacs and Icicles library versions."))
279   :link '(url-link :tag "Other Libraries by Drew"
280           "http://www.emacswiki.org/cgi-bin/wiki/DrewsElispLibraries")
281   :link '(url-link :tag "Download"
282           "http://www.emacswiki.org/cgi-bin/wiki/icicles.el")
283   :link '(url-link :tag "Description"
284           "http://www.emacswiki.org/cgi-bin/wiki/Icicles")
285   :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2")
286   :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1")
287   )
288
289 ;;;###autoload
290 (defgroup Icicles-Searching nil
291   "Icicles preferences related to searching."
292   :prefix "icicle-" :group 'Icicles
293   :link `(url-link :tag "Send Bug Report"
294           ,(concat "mailto:" "drew.adams" "@" "oracle"
295                    ".com?subject=icicles.el bug: \
296 &body=Describe bug here, starting with `emacs -q'.  \
297 Don't forget to mention your Emacs and Icicles library versions."))
298   :link '(url-link :tag "Other Libraries by Drew"
299           "http://www.emacswiki.org/cgi-bin/wiki/DrewsElispLibraries")
300   :link '(url-link :tag "Download"
301           "http://www.emacswiki.org/cgi-bin/wiki/icicles.el")
302   :link '(url-link :tag "Description"
303           "http://www.emacswiki.org/cgi-bin/wiki/Icicles")
304   :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2")
305   :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1")
306   )
307  
308 ;;(@* "Faces, organized alphabetically")
309
310 ;;; Faces, organized alphabetically ----------------------------------
311
312 ;;;###autoload
313 (defface icicle-candidate-part
314     '((((background dark)) (:background "#451700143197")) ; a very dark magenta
315       (t (:background "#EF84FFEAF427"))) ; A light green.
316   "*Face used to highlight part(s) of a candidate in `*Completions*'."
317   :group 'Icicles-Completions-Display :group 'faces)
318
319 ;;;###autoload
320 (defface icicle-common-match-highlight-Completions
321     '((((background dark)) (:foreground "#2017A71F2017")) ; a dark green
322       (t (:foreground "magenta3")))
323   "*Face used to highlight candidates common match, in `*Completions*'."
324   :group 'Icicles-Completions-Display :group 'faces)
325
326 ;;;###autoload
327 (defface icicle-complete-input
328   '((((background dark)) (:foreground "#B19E6A64B19E")) ; a dark magenta
329     (t (:foreground "DarkGreen")))
330   "*Face used to highlight input when it is complete."
331   :group 'Icicles-Minibuffer-Display :group 'faces)
332
333 ;;;###autoload
334 (defface icicle-completion
335     '((((background dark)) (:foreground "#0000D53CD53C")) ; a dark cyan
336       (t (:foreground "Red")))                            ; red
337   "*Face used to indicate minibuffer completion.
338 It highlights the minibuffer indicator and the `Icy' minor-mode
339 lighter during completion.
340 Not used for versions of Emacs before version 21."
341   :group 'Icicles-Minibuffer-Display :group 'Icicles-Miscellaneous :group 'faces)
342
343 ;;;###autoload
344 (defface icicle-Completions-instruction-1
345   '((((background dark)) (:foreground "#AC4AAC4A0000")) ; a dark yellow
346     (t (:foreground "Blue")))
347   "*Face used to highlight first line of `*Completions*' buffer."
348   :group 'Icicles-Completions-Display :group 'faces)
349
350 ;;;###autoload
351 (defface icicle-Completions-instruction-2
352     '((((background dark)) (:foreground "#0000D53CD53C")) ; a dark cyan
353       (t (:foreground "Red")))
354   "*Face used to highlight second line of `*Completions*' buffer."
355   :group 'Icicles-Completions-Display :group 'faces)
356
357 ;;;###autoload
358 (defface icicle-current-candidate-highlight
359   '((((background dark)) (:background "#69D40A460000")) ; a red brown
360     (t (:background "CadetBlue1")))
361   "*Face used to highlight the current candidate, in `*Completions*'."
362   :group 'Icicles-Completions-Display :group 'faces)
363
364 ;;;###autoload
365 (defface icicle-extra-candidate
366     '((((background dark)) (:background "#4517305D0000")) ; a dark brown
367       (t (:background "#C847D8FEFFFF"))) ; a light blue
368   "*Face used to highlight `*Completions*' candidates that are extra.
369 This means that they belong to list `icicle-extra-candidates'."
370   :group 'Icicles-Completions-Display :group 'faces)
371
372 ;;;###autoload
373 (defface icicle-historical-candidate
374   '((((background dark)) (:foreground "#DBD599DF0000")) ; a dark orange
375     (t (:foreground "Blue")))
376   "*Face used to highlight `*Completions*' candidates that have been used."
377   :group 'Icicles-Completions-Display :group 'faces)
378
379 ;;;###autoload
380 (defface icicle-input-completion-fail
381     '((((background dark)) (:background "#22225F5F2222")) ; a dark green
382       (t (:foreground "Black" :background "Plum")))
383   "*Face for highlighting failed part of input during strict completion."
384   :group 'Icicles-Minibuffer-Display :group 'faces)
385
386 ;;;###autoload
387 (defface icicle-input-completion-fail-lax
388     '((((background dark)) (:background "#00005E3B5A8D")) ; a dark cyan
389       (t (:foreground "Black" :background "#FFFFB8C4BB87")))
390   "*Face for highlighting failed part of input during lax completion."
391   :group 'Icicles-Minibuffer-Display :group 'faces)
392
393 ;;;###autoload
394 (defface icicle-match-highlight-Completions
395     '((((background dark)) (:foreground "#1F1FA21CA21C")) ; a very dark cyan
396       (t (:foreground "Red3")))
397   "*Face used to highlight root that was completed, in `*Completions*'."
398   :group 'Icicles-Completions-Display :group 'faces)
399
400 ;;;###autoload
401 (defface icicle-match-highlight-minibuffer '((t (:underline t)))
402   "*Face used to highlight root that was completed, in minibuffer."
403   :group 'Icicles-Minibuffer-Display :group 'faces)
404
405 ;;;###autoload
406 (defface icicle-mode-line-help
407   '((((background dark)) (:foreground "#AC4AAC4A0000")) ; a dark yellow
408     (t (:foreground "Blue")))
409   "*Face used to highlight help shown in the mode-line."
410   :group 'Icicles-Completions-Display :group 'Icicles-Miscellaneous :group 'faces)
411
412 ;;;###autoload
413 (defface icicle-multi-command-completion
414     '((((background dark)) ; a dark cyan on a dark magenta
415        (:foreground "#0000D53CD53C" :background "#8B3500007533"))
416       (t (:foreground "Red" :background "#78F6FFFF8E4F"))) ; red on a light green
417   "*Face used to indicate Icicles multi-command completion.
418 It highlights the minibuffer indicator and the `Icy+' minor-mode
419 lighter during multi-command completion.
420 Not used for versions of Emacs before version 21."
421   :group 'Icicles-Minibuffer-Display :group 'Icicles-Miscellaneous :group 'faces)
422
423 ;;;###autoload
424 (defface icicle-mustmatch-completion
425     '((((type x w32 mac graphic) (class color))
426        (:box (:line-width -2 :color "Blue"))) ; blue box
427       (t (:inverse-video t)))
428   "*Face used to indicate strict minibuffer completion.
429 It highlights the minibuffer indicator and the `Icy' or `Icy+'
430 minor-mode lighter during strict completion.
431 Not used for versions of Emacs before version 21."
432   :group 'Icicles-Minibuffer-Display :group 'Icicles-Miscellaneous :group 'faces)
433
434 ;;;###autoload
435 (defface icicle-proxy-candidate
436     '((((background dark)) (:background "#316B22970000")) ; a very dark brown
437       (t (:background "#E1E1EAEAFFFF"   ; A light blue.
438           :box (:line-width 2 :color "White" :style released-button))))
439   "*Face used to highlight proxy candidates in `*Completions*'."
440   :group 'Icicles-Completions-Display :group 'faces)
441
442 ;;;###autoload
443 (defface icicle-saved-candidate
444     '((((background dark)) (:background "gray20"))   ; a dark gray
445       (t (:background "gray80"))) ; a light gray
446   "*Face used to highlight `*Completions*' candidates that have been saved."
447   :group 'Icicles-Completions-Display :group 'faces)
448
449 ;;;###autoload
450 (defface icicle-search-main-regexp-current
451   '((((background dark)) (:background "#00004AA652F1")) ; a dark cyan
452     (t (:background "misty rose")))
453   "*Face used to highlight current match of your search context regexp.
454 This highlighting is done during Icicles searching."
455   :group 'Icicles-Searching :group 'faces)
456
457 (eval-after-load "hexrgb"
458   '(progn
459
460     ;; Essentially a version of `doremi-increment-color-component' for hue only.
461     ;; Must be before `icicle-search-context-level-1'.
462     (defun icicle-increment-color-hue (color increment)
463       "Increase hue component of COLOR by INCREMENT."
464       (unless (string-match "#" color)  ; Convert color name to #hhh...
465         (setq color  (hexrgb-color-values-to-hex (x-color-values color))))
466       ;; Convert RGB to HSV
467       (let* ((rgb         (x-color-values color))
468              (red         (/ (float (nth 0 rgb)) 65535.0)) ; Convert from 0-65535 to 0.0-1.0
469              (green       (/ (float (nth 1 rgb)) 65535.0))
470              (blue        (/ (float (nth 2 rgb)) 65535.0))
471              (hsv         (hexrgb-rgb-to-hsv red green blue))
472              (hue         (nth 0 hsv))
473              (saturation  (nth 1 hsv))
474              (value       (nth 2 hsv)))
475         (setq hue  (+ hue (/ increment 100.0)))
476         (when (> hue 1.0) (setq hue  (1- hue)))
477         (hexrgb-color-values-to-hex (mapcar (lambda (x) (floor (* x 65535.0)))
478                                             (hexrgb-hsv-to-rgb hue saturation value)))))
479
480     (icicle-maybe-byte-compile-after-load icicle-increment-color-hue)
481
482
483     ;; Essentially a version of `doremi-increment-color-component' for saturation only.
484     ;; Must be before `icicle-search-context-level-1'.
485     (defun icicle-increment-color-saturation (color increment)
486       "Increase saturation component of COLOR by INCREMENT."
487       (unless (string-match "#" color)  ; Convert color name to #hhh...
488         (setq color  (hexrgb-color-values-to-hex (x-color-values color))))
489       ;; Convert RGB to HSV
490       (let* ((rgb         (x-color-values color))
491              (red         (/ (float (nth 0 rgb)) 65535.0)) ; Convert from 0-65535 to 0.0-1.0
492              (green       (/ (float (nth 1 rgb)) 65535.0))
493              (blue        (/ (float (nth 2 rgb)) 65535.0))
494              (hsv         (hexrgb-rgb-to-hsv red green blue))
495              (hue         (nth 0 hsv))
496              (saturation  (nth 1 hsv))
497              (value       (nth 2 hsv)))
498         (setq saturation  (+ saturation (/ increment 100.0)))
499         (when (> saturation 1.0) (setq saturation  (1- saturation)))
500         (hexrgb-color-values-to-hex (mapcar (lambda (x) (floor (* x 65535.0)))
501                                             (hexrgb-hsv-to-rgb hue saturation value)))))
502
503     (icicle-maybe-byte-compile-after-load icicle-increment-color-saturation)
504
505
506     ;; Essentially a version of `doremi-increment-color-component' for value only.
507     ;; Must be before `icicle-region-background'.
508     (defun icicle-increment-color-value (color increment)
509       "Increase value component (brightness) of COLOR by INCREMENT."
510       (unless (string-match "#" color)  ; Convert color name to #hhh...
511         (setq color  (hexrgb-color-values-to-hex (x-color-values color))))
512       ;; Convert RGB to HSV
513       (let* ((rgb         (x-color-values color))
514              (red         (/ (float (nth 0 rgb)) 65535.0)) ; Convert from 0-65535 to 0.0-1.0
515              (green       (/ (float (nth 1 rgb)) 65535.0))
516              (blue        (/ (float (nth 2 rgb)) 65535.0))
517              (hsv         (hexrgb-rgb-to-hsv red green blue))
518              (hue         (nth 0 hsv))
519              (saturation  (nth 1 hsv))
520              (value       (nth 2 hsv)))
521         (setq value  (+ value (/ increment 100.0)))
522         (when (> value 1.0) (setq value  (1- value)))
523         (hexrgb-color-values-to-hex (mapcar (lambda (x) (floor (* x 65535.0)))
524                                             (hexrgb-hsv-to-rgb hue saturation value)))))
525
526     (icicle-maybe-byte-compile-after-load icicle-increment-color-value)
527
528     ))
529
530 ;;;###autoload
531 (defface icicle-search-context-level-1
532     (let ((context-bg  (face-background 'icicle-search-main-regexp-current)))
533       `((((background dark))
534          (:background ,(if (fboundp 'icicle-increment-color-saturation)
535                            (icicle-increment-color-saturation
536                             (icicle-increment-color-hue context-bg 80) 10)
537                            "#071F473A0000"))) ; a dark green
538         (t (:background ,(if (fboundp 'icicle-increment-color-saturation)
539                              (icicle-increment-color-saturation
540                               (icicle-increment-color-hue context-bg 80) 10)
541                              "#FA6CC847FFFF"))))) ; a light magenta
542   "*Face used to highlight level (subgroup match) 1 of your search context.
543 This highlighting is done during Icicles searching whenever
544 `icicle-search-highlight-context-levels-flag' is non-nil and the
545 search context corresponds to the entire regexp."
546   :group 'Icicles-Searching :group 'faces)
547
548 ;;;###autoload
549 (defface icicle-search-context-level-2
550     (let ((context-bg  (face-background 'icicle-search-main-regexp-current)))
551       `((((background dark))
552          (:background ,(if (fboundp 'icicle-increment-color-saturation)
553                            (icicle-increment-color-saturation
554                             (icicle-increment-color-hue context-bg 40) 10)
555                            "#507400002839"))) ; a dark red
556         (t (:background ,(if (fboundp 'icicle-increment-color-saturation)
557                              (icicle-increment-color-saturation
558                               (icicle-increment-color-hue context-bg 40) 10)
559                              "#C847FFFFE423"))))) ; a light cyan
560   "*Face used to highlight level (subgroup match) 2 of your search context.
561 This highlighting is done during Icicles searching whenever
562 `icicle-search-highlight-context-levels-flag' is non-nil and the
563 search context corresponds to the entire regexp."
564   :group 'Icicles-Searching :group 'faces)
565
566 ;;;###autoload
567 (defface icicle-search-context-level-3
568     (let ((context-bg  (face-background 'icicle-search-main-regexp-current)))
569       `((((background dark))
570          (:background ,(if (fboundp 'icicle-increment-color-saturation)
571                            (icicle-increment-color-saturation
572                             (icicle-increment-color-hue context-bg 60) 10)
573                            "#4517305D0000"))) ; a dark brown
574         (t (:background ,(if (fboundp 'icicle-increment-color-saturation)
575                              (icicle-increment-color-saturation
576                               (icicle-increment-color-hue context-bg 60) 10)
577                              "#C847D8FEFFFF"))))) ; a light blue
578   "*Face used to highlight level (subgroup match) 3 of your search context.
579 This highlighting is done during Icicles searching whenever
580 `icicle-search-highlight-context-levels-flag' is non-nil and the
581 search context corresponds to the entire regexp."
582   :group 'Icicles-Searching :group 'faces)
583
584 ;;;###autoload
585 (defface icicle-search-context-level-4
586     (let ((context-bg  (face-background 'icicle-search-main-regexp-current)))
587       `((((background dark))
588          (:background ,(if (fboundp 'icicle-increment-color-saturation)
589                            (icicle-increment-color-saturation
590                             (icicle-increment-color-hue context-bg 20) 10)
591                            "#176900004E0A"))) ; a dark blue
592         (t (:background ,(if (fboundp 'icicle-increment-color-saturation)
593                              (icicle-increment-color-saturation
594                               (icicle-increment-color-hue context-bg 20) 10)
595                              "#EF47FFFFC847"))))) ; a light yellow
596   "*Face used to highlight level (subgroup match) 4 of your search context.
597 This highlighting is done during Icicles searching whenever
598 `icicle-search-highlight-context-levels-flag' is non-nil and the
599 search context corresponds to the entire regexp."
600   :group 'Icicles-Searching :group 'faces)
601
602 ;;;###autoload
603 (defface icicle-search-context-level-5
604     (let ((context-bg  (face-background 'icicle-search-main-regexp-current)))
605       `((((background dark))
606          (:background ,(if (fboundp 'icicle-increment-color-saturation)
607                            (icicle-increment-color-hue context-bg 80)
608                            "#04602BC00000"))) ; a very dark green
609         (t (:background ,(if (fboundp 'icicle-increment-color-saturation)
610                              (icicle-increment-color-hue context-bg 80)
611                              "#FCFCE1E1FFFF"))))) ; a light magenta
612   "*Face used to highlight level (subgroup match) 5 of your search context.
613 This highlighting is done during Icicles searching whenever
614 `icicle-search-highlight-context-levels-flag' is non-nil and the
615 search context corresponds to the entire regexp."
616   :group 'Icicles-Searching :group 'faces)
617
618 ;;;###autoload
619 (defface icicle-search-context-level-6
620     (let ((context-bg  (face-background 'icicle-search-main-regexp-current)))
621       `((((background dark))
622          (:background ,(if (fboundp 'icicle-increment-color-saturation)
623                            (icicle-increment-color-hue context-bg 40)
624                            "#32F200001979"))) ; a very dark red
625         (t (:background ,(if (fboundp 'icicle-increment-color-saturation)
626                              (icicle-increment-color-hue context-bg 40)
627                              "#E1E1FFFFF0F0"))))) ; a light cyan
628   "*Face used to highlight level (subgroup match) 6 of your search context.
629 This highlighting is done during Icicles searching whenever
630 `icicle-search-highlight-context-levels-flag' is non-nil and the
631 search context corresponds to the entire regexp."
632   :group 'Icicles-Searching :group 'faces)
633
634 ;;;###autoload
635 (defface icicle-search-context-level-7
636     (let ((context-bg  (face-background 'icicle-search-main-regexp-current)))
637       `((((background dark))
638          (:background ,(if (fboundp 'icicle-increment-color-saturation)
639                            (icicle-increment-color-hue context-bg 60)
640                            "#316B22970000"))) ; a very dark brown
641         (t (:background ,(if (fboundp 'icicle-increment-color-saturation)
642                              (icicle-increment-color-hue context-bg 60)
643                              "#E1E1EAEAFFFF"))))) ; a light blue
644   "*Face used to highlight level (subgroup match) 7 of your search context.
645 This highlighting is done during Icicles searching whenever
646 `icicle-search-highlight-context-levels-flag' is non-nil and the
647 search context corresponds to the entire regexp."
648   :group 'Icicles-Searching :group 'faces)
649
650 ;;;###autoload
651 (defface icicle-search-context-level-8
652     (let ((context-bg  (face-background 'icicle-search-main-regexp-current)))
653       `((((background dark))
654          (:background ,(if (fboundp 'icicle-increment-color-saturation)
655                            (icicle-increment-color-hue context-bg 20)
656                            "#12EC00003F0E"))) ; a very dark blue
657         (t (:background ,(if (fboundp 'icicle-increment-color-saturation)
658                              (icicle-increment-color-hue context-bg 20)
659                              "#F6F5FFFFE1E1"))))) ; a light yellow
660   "*Face used to highlight level (subgroup match) 8 of your search context.
661 This highlighting is done during Icicles searching whenever
662 `icicle-search-highlight-context-levels-flag' is non-nil and the
663 search context corresponds to the entire regexp."
664   :group 'Icicles-Searching :group 'faces)
665
666 ;;;###autoload
667 (defface icicle-search-current-input
668     '((((background dark))
669        (:foreground "White" :background "#7F0D00007F0D")) ; a dark magenta
670       (t (:foreground "Black" :background "Green")))
671   "*Face used to highlight what your current input matches.
672 This highlighting is done during Icicles searching whenever
673 `icicle-search-highlight-context-levels-flag' is non-nil and the
674 search context corresponds to the entire regexp."
675   :group 'Icicles-Searching :group 'faces)
676
677 ;;;###autoload
678 (defface icicle-search-main-regexp-others
679   '((((background dark)) (:background "#348608690000")) ; a very dark brown
680     (t (:background "CadetBlue1")))
681   "*Face used to highlight other matches of your search context regexp.
682 If user option `icicle-search-highlight-threshold' is less than one,
683 then this face is not used.
684 This highlighting is done during Icicles searching."
685   :group 'Icicles-Searching :group 'faces)
686
687 ;;;###autoload
688 (defface icicle-special-candidate
689     '((((background dark)) (:background "#176900004E0A")) ; a dark blue
690       (t (:background "#EF47FFFFC847")))   ; A light yellow.
691   "*Face used to highlight `*Completions*' candidates that are special.
692 The meaning of special is that their names match
693 `icicle-special-candidate-regexp'."
694   :group 'Icicles-Completions-Display :group 'faces)
695
696 ;;;###autoload
697 (defface icicle-whitespace-highlight
698     '((((background dark)) (:background "#000093F402A2")) ; a medium green
699       (t (:background "Magenta")))
700   "*Face used to highlight initial whitespace in minibuffer input."
701   :group 'Icicles-Minibuffer-Display :group 'faces)
702
703 ;; This is defined in `faces.el', Emacs 22.  This is for Emacs < 22.  This is used
704 ;; only for versions of Emacs that have `propertize' but don't have this face.
705 (unless (facep 'minibuffer-prompt)
706   (defface minibuffer-prompt '((((background dark)) (:foreground "cyan"))
707                                (t (:foreground "dark blue")))
708     "*Face for minibuffer prompts."
709     :group 'basic-faces))
710
711 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
712
713 (provide 'icicles-face)
714
715 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
716 ;;; icicles-face.el ends here