Initial Commit
[packages] / xemacs-packages / xwem / lisp / xwem-theme.el
1 ;;; xwem-theme.el --- Themes support for xwem.
2
3 ;; Copyright (C) 2004,2005 by XWEM Org.
4
5 ;; Author: Zajcev Evgeny <zevlg@yandex.ru>
6 ;; Created: Tue Nov 23 14:49:41 MSK 2004
7 ;; Keywords: xwem
8 ;; X-CVS: $Id: xwem-theme.el,v 1.5 2005-04-04 19:54:16 lg Exp $
9
10 ;; This file is part of XWEM.
11
12 ;; XWEM is free software; you can redistribute it and/or modify it
13 ;; under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; any later version.
16
17 ;; XWEM is distributed in the hope that it will be useful, but WITHOUT
18 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
20 ;; License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with XEmacs; see the file COPYING.  If not, write to the Free
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 ;; 02111-1307, USA.
26
27 ;;; Synched up with: Not in FSF
28
29 ;;; Commentary:
30
31 ;; 
32
33 ;;; Code:
34 \f
35 (require 'xwem-load)
36
37 (defgroup xwem-theme nil
38   "Group to customize xwem themes."
39   :prefix "xwem-theme-"
40   :group 'xwem)
41
42 (defcustom xwem-theme-default
43   `((face xwem-tabber-face
44      (((frame-selected tab-selected)
45        (:foreground "white" :background "green4" :bold t))
46       ((delimiter-left frame-selected tab-selected)
47        (:foreground "white"))
48       ((delimiter-right frame-selected tab-selected)
49        (:foreground "black"))
50
51       ((frame-selected tab-nonselected)
52        (:foreground "black" :background "gray80"))
53       ((delimiter-left frame-selected tab-nonselected)
54        (:foreground "white"))
55       ((delimiter-right frame-selected tab-nonselected)
56        (:foreground "black"))
57
58       ((frame-nonselected tab-selected)
59        (:foreground "gray80" :background "DarkGreen" :bold t))
60       ((delimiter-left frame-nonselected tab-selected)
61        (:foreground "white"))
62       ((delimiter-right frame-nonselected tab-selected)
63        (:foreground "black"))
64
65       ((frame-nonselected tab-nonselected)
66        (:foreground "black" :background "gray40"))
67       ((delimiter-left frame-nonselected tab-nonselected)
68        (:foreground "white"))
69       ((delimiter-right frame-nonselected tab-nonselected)
70        (:foreground "black"))
71
72       (t (:foreground "white"))))
73
74     (face x-border-face
75      (((selected) (:foreground "green"))
76       (t (:foreground "gray80"))))
77
78     (face xwem-frame-inner-border-face
79      (((light nonselected)
80        (:foreground "gray80" :background "gray80"))
81       ((medium nonselected)
82        (:foreground "gray50" :background "gray50"))
83       ((dark nonselected)
84        (:foreground "gray20" :background "gray20"))
85       ((light selected)
86        (:foreground "cyan2" :background "cyan2"))
87       ((medium selected)
88        (:foreground "royalblue" :background "royalblue"))
89       ((dark selected)
90        (:foreground "blue4" :background "blue4"))))
91
92     (face xwem-launch-dock-face
93      (((medium) (:foreground "gray70"))
94       ((light) (:foreground "white"))
95       ((dark) (:foreground "black"))))
96
97     (face xwem-strokes-face
98      (((background light)
99        (:foreground "red4" :background "black"))
100       ((background dark)
101        (:foreground "red" :background "black"))
102       ((background begin light)
103        (:foreground "magenta4" :background "black"
104         :line-width 12 :cap-style X-CapRound))
105       ((background begin dark)
106        (:foreground "magenta" :background "black"
107         :line-width 12 :cap-style X-CapRound))))
108
109     (face xwem-tray-delimiter-face
110      (((background light)
111        (:foreground "gray40"))
112       ((background light shadow)
113        (:foreground "gray30"))
114       ((background dark)
115        (:foreground "gray70"))
116       ((background dark shadow)
117        (:foreground "gray80"))))
118
119     (face xwem-window-outline-face
120      (((frame-selected win-selected)
121        (:foreground "green" :background "green4" :line-width 4))
122       ((frame-selected win-nonselected)
123        (:foreground "gray70" :background "gray70" :line-width 4))
124       ((frame-nonselected win-selected)
125        (:foreground "green3" :background "green4" :line-width 4))
126       ((frame-nonselected win-nonselected)
127        (:foreground "gray60" :background "gray40" :line-width 4))))
128
129     (face xwem-window-delimiter-face
130      (((horizontal)
131        (:foreground "royalblue" :background "black"))
132       ((horizontal shadow)
133        (:foreground "blue4" :background "black"))
134       ((horizontal light shadow)
135        (:foreground "cyan" :background "black"))
136       ((vertical)
137        (:foreground "royalblue" :background "black"))
138       ((shadow vertical)
139        (:foreground "blue4" :background "black"))
140       ((light shadow vertical)
141        (:foreground "cyan" :background "black"))
142       (t (:foreground "gray20" :background "black"))))
143
144     ;; Frames properties
145     (frame-property inner-border-width 8)
146     (frame-property inner-border-thickness 2)
147     (frame-property title-height 18)
148
149     ;; Clients properties
150     (client-property x-border-width 2)
151
152     ;; Custom settings
153     (custom xwem-cursor-help-foreground-color "#00BB00")
154     (custom xwem-cursor-help-background-color "#009900")
155     (custom xwem-root-cursor-foreground-color "white")
156     (custom xwem-root-cursor-background-color "black")
157     (custom xwem-frame-cursor-foreground-color "#111111")
158     (custom xwem-frame-cursor-background-color "#EEEEEE")
159
160     (custom xwem-minibuffer-bgcol "gray80")
161     )
162   "Default xwem theme."
163   :type 'xwem-theme
164   :group 'xwem-theme)
165
166 (defcustom xwem-theme-extrim
167   `((face xwem-tabber-face
168      (((frame-selected tab-selected)
169        (:foreground "white" :background "gray20"
170         :font "-*-fixed-medium-r-*-*-12-*-*-*-*-*-*-*" :bold t))
171       ((delimiter-left frame-selected tab-selected)
172        (:foreground "white"))
173       ((delimiter-right frame-selected tab-selected)
174        (:foreground "black"))
175
176       ((frame-selected tab-nonselected)
177        (:foreground "black" :background "gray80"
178         :font "-*-fixed-medium-r-*-*-12-*-*-*-*-*-*-*"))
179       ((delimiter-left frame-selected tab-nonselected)
180        (:foreground "white"))
181       ((delimiter-right frame-selected tab-nonselected)
182        (:foreground "black"))
183
184       ((frame-nonselected tab-selected)
185        (:foreground "gray80" :background "gray40"
186         :font "-*-fixed-medium-r-*-*-12-*-*-*-*-*-*-*" :bold t))
187       ((delimiter-left frame-nonselected tab-selected)
188        (:foreground "white"))
189       ((delimiter-right frame-nonselected tab-selected)
190        (:foreground "black"))
191
192       ((frame-nonselected tab-nonselected)
193        (:foreground "black" :background "gray40"
194         :font "-*-fixed-medium-r-*-*-12-*-*-*-*-*-*-*"))
195       ((delimiter-left frame-nonselected tab-nonselected)
196        (:foreground "white"))
197       ((delimiter-right frame-nonselected tab-nonselected)
198        (:foreground "black"))
199
200       (t (:foreground "white"))))
201
202     (face x-border-face
203      (((selected) (:foreground "white"))
204       (t (:foreground "dark"))))
205
206     (face xwem-frame-inner-border-face
207      (((light nonselected)
208        (:foreground "gray80"))
209       ((medium nonselected)
210        (:foreground "gray50"))
211       ((dark nonselected)
212        (:foreground "gray20"))
213       ((light selected)
214        (:foreground "white"))
215       ((medium selected)
216        (:foreground "gray50"))
217       ((dark selected)
218        (:foreground "dark"))))
219
220     (face xwem-launch-dock-face
221      (((medium) (:foreground "gray70"))
222       ((light) (:foreground "white"))
223       ((dark) (:foreground "black"))))
224
225     (face xwem-strokes-face
226      (((background light)
227        (:foreground "dimgray" :background "black"))
228       ((background dark)
229        (:foreground "lightgray" :background "black"))
230       ((background begin light)
231        (:foreground "darkslategrey" :background "black"
232         :line-width 12 :cap-style X-CapRound))
233       ((background begin dark)
234        (:foreground "grey" :background "black"
235         :line-width 12 :cap-style X-CapRound))
236       (t (:foreground "dimgray" :background "black"
237           :line-width 6 :cap-style X-CapRound
238           :subwindow-mode X-IncludeInferiors
239           :function (eval xwem-strokes-gc-function)))))
240
241     (face xwem-tray-delimiter-face
242      (((background light)
243        (:foreground "gray40"))
244       ((background light shadow)
245        (:foreground "gray30"))
246       ((background dark)
247        (:foreground "gray70"))
248       ((background dark shadow)
249        (:foreground "gray80"))))
250
251     (face xwem-window-outline-face
252      (((frame-selected win-selected)
253        (:foreground "dark" :background "dark"))
254       ((frame-selected win-nonselected)
255        (:foreground "gray50" :background "gray50"))
256       ((frame-nonselected win-selected)
257        (:foreground "gray20" :background "gray20"))
258       ((frame-nonselected win-nonselected)
259        (:foreground "gray60" :background "gray40"))))
260
261     (face xwem-window-delimiter-face
262      (((horizontal)
263        (:foreground "gray30" :background "black"))
264       ((horizontal shadow)
265        (:foreground "gray10" :background "black"))
266       ((horizontal light shadow)
267        (:foreground "gray80" :background "black"))
268       ((vertical)
269        (:foreground "gray10" :background "black"))
270       ((shadow vertical)
271        (:foreground "gray40" :background "black"))
272       ((light shadow vertical)
273        (:foreground "white" :background "black"))
274       (t (:foreground "gray20" :background "black"))))
275
276     ;; Frames properties
277     (frame-property inner-border-width 3)
278     (frame-property inner-border-thickness 1)
279     (frame-property title-height 12)
280
281     ;; Clients properties
282     (client-property x-border-width 3)
283
284     ;; Custom settings
285     (custom xwem-cursor-help-foreground-color "#888888")
286     (custom xwem-cursor-help-background-color "#080808")
287     (custom xwem-root-cursor-foreground-color "black")
288     (custom xwem-root-cursor-background-color "white")
289     (custom xwem-frame-cursor-foreground-color "white")
290     (custom xwem-frame-cursor-background-color "black")
291
292     (custom xwem-minibuffer-bgcol "black")
293     )
294   "Extrimal xwem theme."
295   :type 'xwem-theme
296   :group 'xwem-theme)
297
298 ;;;; Cursor themes
299 (defconst xwem-cursor-default-theme
300   '((custom xwem-cursor-help-foreground-color "#00BB00")
301     (custom xwem-cursor-help-background-color "#009900")
302     (custom xwem-root-cursor-foreground-color "white")
303     (custom xwem-root-cursor-background-color "black")
304     (custom xwem-frame-cursor-foreground-color "#111111")
305     (custom xwem-frame-cursor-background-color "#EEEEEE")))
306
307 (defconst xwem-cursor-extrim-theme
308   `((custom xwem-cursor-help-foreground-color "#888888")
309     (custom xwem-cursor-help-background-color "#080808")
310     (custom xwem-root-cursor-foreground-color "black")
311     (custom xwem-root-cursor-background-color "white")
312     (custom xwem-frame-cursor-foreground-color "white")
313     (custom xwem-frame-cursor-background-color "black")))
314
315 (defconst xwem-cursor-ocean-theme
316   `((custom xwem-cursor-help-foreground-color "#009999")
317     (custom xwem-cursor-help-background-color "#006B6B")
318     (custom xwem-root-cursor-foreground-color "#005858")
319     (custom xwem-root-cursor-background-color "#AFFFFA")
320     (custom xwem-frame-cursor-foreground-color "#BFFFFB")
321     (custom xwem-frame-cursor-background-color "#006D66")))
322
323 (defconst xwem-cursor-spring-theme
324   `((custom xwem-cursor-help-foreground-color "#00B366")
325     (custom xwem-cursor-help-background-color "#007D48")
326     (custom xwem-root-cursor-foreground-color "#007B3D")
327     (custom xwem-root-cursor-background-color "#BFFFD6")
328     (custom xwem-frame-cursor-foreground-color "#80FFC9")
329     (custom xwem-frame-cursor-background-color "#007D48")))
330
331 (defconst xwem-cursor-winter-theme
332   `((custom xwem-cursor-help-foreground-color "white")
333     (custom xwem-cursor-help-background-color "gray50")
334     (custom xwem-root-cursor-foreground-color "white")
335     (custom xwem-root-cursor-background-color "gray50")
336     (custom xwem-frame-cursor-foreground-color "white")
337     (custom xwem-frame-cursor-background-color "gray50")))
338
339 (defvar xwem-cursor-themes
340   '((default . xwem-cursor-default-theme)
341     (extrim . xwem-cursor-extrim-theme)
342     (ocean . xwem-cursor-ocean-theme)
343     (spring . xwem-cursor-spring-theme)
344     (winter . xwem-cursor-winter-theme))
345   "Alist of themes for cursors colors.
346 Alist in form \(THEME-NAME . THEME-VAR\).")
347
348 ;;;; Frame themes
349 (defconst xwem-frame-default-theme
350   '((frame-property inner-border-width 8)
351     (frame-property inner-border-thickness 2)
352     (frame-property title-height 18)
353     (custom xwem-win-vertical-delim-width (8 . 1))
354     (custom xwem-win-horizontal-delim-width (6 . 1))))
355
356 (defconst xwem-frame-extrim-theme
357   '((frame-property inner-border-width 3)
358     (frame-property inner-border-thickness 1)
359     (frame-property title-height 12)
360     (custom xwem-win-vertical-delim-width (4 . 1))
361     (custom xwem-win-horizontal-delim-width (3 . 1))))
362
363 (defvar xwem-frame-themes
364   '((default . xwem-frame-default-theme)
365     (extrim . xwem-frame-extrim-theme))
366   "Alist of themes for frame.
367 Alist in form \(THEME-NAME . THEME-VAR\).")
368
369 ;;; Internal variables
370 (defvar xwem-managing-themes nil
371   "List of themes to manage clients.")
372
373 (defconst xwem-face-default-theme
374   '((face xwem-tabber-face
375           (((frame-selected tab-selected)
376             (:foreground "white" :background "green4" :bold t))
377            ((delimiter-left frame-selected tab-selected)
378             (:foreground "white"))
379            ((delimiter-right frame-selected tab-selected)
380             (:foreground "black"))
381
382            ((frame-selected tab-nonselected)
383             (:foreground "black" :background "gray80"))
384            ((delimiter-left frame-selected tab-nonselected)
385             (:foreground "white"))
386            ((delimiter-right frame-selected tab-nonselected)
387             (:foreground "black"))
388
389            ((frame-nonselected tab-selected)
390             (:foreground "gray80" :background "DarkGreen" :bold t))
391            ((delimiter-left frame-nonselected tab-selected)
392             (:foreground "white"))
393            ((delimiter-right frame-nonselected tab-selected)
394             (:foreground "black"))
395
396            ((frame-nonselected tab-nonselected)
397             (:foreground "black" :background "gray40"))
398            ((delimiter-left frame-nonselected tab-nonselected)
399             (:foreground "white"))
400            ((delimiter-right frame-nonselected tab-nonselected)
401             (:foreground "black"))
402
403            (t (:foreground "white"))))
404
405     (face x-border-face
406           (((selected) (:foreground "green"))
407            (t (:foreground "gray80"))))
408
409     (face xwem-frame-inner-border-face
410           (((light nonselected)
411             (:foreground "gray80" :background "gray80"))
412            ((medium nonselected)
413             (:foreground "gray50" :background "gray50"))
414            ((dark nonselected)
415             (:foreground "gray20" :background "gray20"))
416            ((light selected)
417             (:foreground "cyan2" :background "cyan2"))
418            ((medium selected)
419             (:foreground "royalblue" :background "royalblue"))
420            ((dark selected)
421             (:foreground "blue4" :background "blue4"))))
422
423     (face xwem-launch-dock-face
424           (((medium) (:foreground "gray70"))
425            ((light) (:foreground "white"))
426            ((dark) (:foreground "black"))))
427
428     (face xwem-strokes-face
429           (((background light)
430             (:foreground "red4" :background "black"))
431            ((background dark)
432             (:foreground "red" :background "black"))
433            ((background begin light)
434             (:foreground "magenta4" :background "black"
435                          :line-width 12 :cap-style X-CapRound))
436            ((background begin dark)
437             (:foreground "magenta" :background "black"
438                          :line-width 12 :cap-style X-CapRound))))
439
440     (face xwem-tray-delimiter-face
441           (((background light)
442             (:foreground "gray40"))
443            ((background light shadow)
444             (:foreground "gray30"))
445            ((background dark)
446             (:foreground "gray70"))
447            ((background dark shadow)
448             (:foreground "gray80"))))
449
450     (face xwem-window-outline-face
451           (((frame-selected win-selected)
452             (:foreground "green" :background "green4" :line-width 4))
453            ((frame-selected win-nonselected)
454             (:foreground "gray70" :background "gray70" :line-width 4))
455            ((frame-nonselected win-selected)
456             (:foreground "green3" :background "green4" :line-width 4))
457            ((frame-nonselected win-nonselected)
458             (:foreground "gray60" :background "gray40" :line-width 4))))
459
460     (face xwem-window-delimiter-face
461           (((horizontal)
462             (:foreground "royalblue" :background "black"))
463            ((horizontal shadow)
464             (:foreground "blue4" :background "black"))
465            ((horizontal light shadow)
466             (:foreground "cyan" :background "black"))
467            ((vertical)
468             (:foreground "royalblue" :background "black"))
469            ((shadow vertical)
470             (:foreground "blue4" :background "black"))
471            ((light shadow vertical)
472             (:foreground "cyan" :background "black"))
473            (t (:foreground "gray20" :background "black")))))
474   "Default faces theme.")
475
476 (defconst xwem-face-extrim-theme
477   `((face xwem-tabber-face
478      (((frame-selected tab-selected)
479        (:foreground "white" :background "gray20"
480         :font "-*-fixed-medium-r-*-*-12-*-*-*-*-*-*-*" :bold t))
481       ((delimiter-left frame-selected tab-selected)
482        (:foreground "white"))
483       ((delimiter-right frame-selected tab-selected)
484        (:foreground "black"))
485
486       ((frame-selected tab-nonselected)
487        (:foreground "black" :background "gray80"
488         :font "-*-fixed-medium-r-*-*-12-*-*-*-*-*-*-*"))
489       ((delimiter-left frame-selected tab-nonselected)
490        (:foreground "white"))
491       ((delimiter-right frame-selected tab-nonselected)
492        (:foreground "black"))
493
494       ((frame-nonselected tab-selected)
495        (:foreground "gray80" :background "gray40"
496         :font "-*-fixed-medium-r-*-*-12-*-*-*-*-*-*-*" :bold t))
497       ((delimiter-left frame-nonselected tab-selected)
498        (:foreground "white"))
499       ((delimiter-right frame-nonselected tab-selected)
500        (:foreground "black"))
501
502       ((frame-nonselected tab-nonselected)
503        (:foreground "black" :background "gray40"
504         :font "-*-fixed-medium-r-*-*-12-*-*-*-*-*-*-*"))
505       ((delimiter-left frame-nonselected tab-nonselected)
506        (:foreground "white"))
507       ((delimiter-right frame-nonselected tab-nonselected)
508        (:foreground "black"))))
509
510     (face x-border-face
511      (((selected) (:foreground "white"))
512       (t (:foreground "dark"))))
513
514     (face xwem-frame-inner-border-face
515      (((light nonselected)
516        (:foreground "gray80"))
517       ((medium nonselected)
518        (:foreground "gray50"))
519       ((dark nonselected)
520        (:foreground "gray20"))
521       ((light selected)
522        (:foreground "white"))
523       ((medium selected)
524        (:foreground "gray50"))
525       ((dark selected)
526        (:foreground "dark"))))
527
528     (face xwem-launch-dock-face
529      (((medium) (:foreground "gray70"))
530       ((light) (:foreground "white"))
531       ((dark) (:foreground "black"))))
532
533     (face xwem-strokes-face
534      (((background light)
535        (:foreground "dimgray" :background "black"))
536       ((background dark)
537        (:foreground "lightgray" :background "black"))
538       ((background begin light)
539        (:foreground "darkslategrey" :background "black"
540         :line-width 12 :cap-style X-CapRound))
541       ((background begin dark)
542        (:foreground "grey" :background "black"
543         :line-width 12 :cap-style X-CapRound))))
544
545     (face xwem-tray-delimiter-face
546      (((background light)
547        (:foreground "gray40"))
548       ((background light shadow)
549        (:foreground "gray30"))
550       ((background dark)
551        (:foreground "gray70"))
552       ((background dark shadow)
553        (:foreground "gray80"))))
554
555     (face xwem-window-outline-face
556      (((frame-selected win-selected)
557        (:foreground "dark" :background "dark"))
558       ((frame-selected win-nonselected)
559        (:foreground "gray50" :background "gray50"))
560       ((frame-nonselected win-selected)
561        (:foreground "gray20" :background "gray20"))
562       ((frame-nonselected win-nonselected)
563        (:foreground "gray60" :background "gray40"))))
564
565     (face xwem-window-delimiter-face
566      (((horizontal)
567        (:foreground "gray30" :background "black"))
568       ((horizontal shadow)
569        (:foreground "gray10" :background "black"))
570       ((horizontal light shadow)
571        (:foreground "gray80" :background "black"))
572       ((vertical)
573        (:foreground "gray10" :background "black"))
574       ((shadow vertical)
575        (:foreground "gray40" :background "black"))
576       ((light shadow vertical)
577        (:foreground "white" :background "black")))))
578   "Extrim face theme.")
579
580 (defconst xwem-face-ocean-theme
581   '((face xwem-tabber-face
582           (((frame-selected tab-selected)
583             (:foreground "#7DC5C5" :background "#174D4D" :bold t))
584            ((delimiter-left frame-selected tab-selected)
585             (:foreground "white"))
586            ((delimiter-right frame-selected tab-selected)
587             (:foreground "black"))
588
589            ((frame-selected tab-nonselected)
590             (:foreground "#102A2A" :background "#598080"))
591            ((delimiter-left frame-selected tab-nonselected)
592             (:foreground "white"))
593            ((delimiter-right frame-selected tab-nonselected)
594             (:foreground "black"))
595
596            ((frame-nonselected tab-selected)
597             (:foreground "#6BA0A0" :background "#406060" :bold t))
598            ((delimiter-left frame-nonselected tab-selected)
599             (:foreground "white"))
600            ((delimiter-right frame-nonselected tab-selected)
601             (:foreground "black"))
602
603            ((frame-nonselected tab-nonselected)
604             (:foreground "#123D3D" :background "#507070"))
605            ((delimiter-left frame-nonselected tab-nonselected)
606             (:foreground "white"))
607            ((delimiter-right frame-nonselected tab-nonselected)
608             (:foreground "black"))))
609
610     (face x-border-face
611           (((selected) (:foreground "#10BABA"))
612            (t (:foreground "#085580"))))
613
614     (face xwem-frame-inner-border-face
615           (((light nonselected)
616             (:foreground "gray80" :background "gray80"))
617            ((medium nonselected)
618             (:foreground "gray50" :background "gray50"))
619            ((dark nonselected)
620             (:foreground "gray20" :background "gray20"))
621            ((light selected)
622             (:foreground "#7DB3B3" :background "#7DB3B3"))
623            ((medium selected)
624             (:foreground "#176D6D" :background "#176D6D"))
625            ((dark selected)
626             (:foreground "#102A2A" :background "#102A2A"))))
627
628     (face xwem-launch-dock-face
629           (((medium) (:foreground "#176D6D"))
630            ((light) (:foreground "#7DB3B3"))
631            ((dark) (:foreground "#102A2A"))))
632
633     (face xwem-strokes-face
634           (((background light)
635             (:foreground "#176D6D" :background "black"))
636            ((background dark)
637             (:foreground "#7DB3B3" :background "black"))
638            ((background begin light)
639             (:foreground "#154C4C" :background "black"
640                          :line-width 12 :cap-style X-CapRound))
641            ((background begin dark)
642             (:foreground "#6DA0A0" :background "black"
643                          :line-width 12 :cap-style X-CapRound))))
644
645     (face xwem-tray-delimiter-face
646           (((background light)
647             (:foreground "gray40"))
648            ((background light shadow)
649             (:foreground "gray30"))
650            ((background dark)
651             (:foreground "gray70"))
652            ((background dark shadow)
653             (:foreground "gray80"))))
654
655     (face xwem-window-outline-face
656           (((frame-selected win-selected)
657             (:foreground "#10BABA" :background "green4" :line-width 4))
658            ((frame-selected win-nonselected)
659             (:foreground "gray70" :background "gray70" :line-width 4))
660            ((frame-nonselected win-selected)
661             (:foreground "#109898" :background "green4" :line-width 4))
662            ((frame-nonselected win-nonselected)
663             (:foreground "gray60" :background "gray40" :line-width 4))))
664
665     (face xwem-window-delimiter-face
666           (((horizontal)
667             (:foreground "#176D6D" :background "#176D6D"))
668            ((horizontal shadow)
669             (:foreground "#102A2A" :background "#102A2A"))
670            ((horizontal light shadow)
671             (:foreground "#7DB3B3" :background "#7DB3B3"))
672            ((vertical)
673             (:foreground "#176D6D" :background "#176D6D"))
674            ((shadow vertical)
675             (:foreground "#102A2A" :background "#102A2A"))
676            ((light shadow vertical)
677             (:foreground "#7DB3B3" :background "#7DB3B3")))))
678   "Ocean faces theme.")
679
680 (defvar xwem-face-themes
681   '((default . xwem-face-default-theme)
682     (extrim . xwem-face-extrim-theme)
683     (ocean . xwem-face-ocean-theme)
684     )
685   "List of themes for xwem faces.")
686
687 (defvar xwem-frame-themes nil
688   "List of themes for frames.")
689
690 (defvar xwem-client-themes nil
691   "List of themes for clients.")
692
693 (defvar xwem-theme-themes '(xwem-theme-default xwem-theme-extrim)
694   "List of themes.")
695   
696 (defun xwem-theme-apply-face-spec (face spec domain)
697   "Apply to FACE it spec."
698   (let (tag-set vplist tt tv vfont)
699     (while spec
700       (setq tag-set (car (car spec))
701             vplist (cadr (car spec))
702             vfont nil)
703
704       ;; Apply attributes
705       (while vplist
706         (setq tt (car vplist)
707               tv (cadr vplist))
708         (cond ((eq tt :foreground)
709                (xwem-set-face-foreground face tv tag-set domain))
710               ((eq tt :background)
711                (xwem-set-face-background face tv tag-set domain))
712               ((eq tt :line-style)
713                (xwem-set-face-line-style face tv tag-set domain))
714               ((eq tt :line-width)
715                (xwem-set-face-line-width face tv tag-set domain))
716               ((eq tt :cap-style)
717                (xwem-set-face-cap-style face tv tag-set domain))
718               ((eq tt :join-style)
719                (xwem-set-face-join-style face tv tag-set domain))
720               ((eq tt :function)
721                (xwem-set-face-function face tv tag-set domain))
722               ((eq tt :subwindow-mode)
723                (xwem-set-face-subwindow-mode face tv tag-set domain))
724               ((eq tt :graphics-exposures)
725                (xwem-set-face-graphics-exposures face tv tag-set domain))
726               ((eq tt :font)
727                (setq vfont tv)
728                (xwem-set-face-font face tv tag-set domain))
729               ((eq tt :bold)
730                (if tv
731                    (setq tv (or (x-make-font-bold (or vfont (face-font-name face)))
732                                 (or vfont (face-font-name face '(default)))))
733                  (setq tv (or (x-make-font-unbold (or vfont (face-font-name face)))
734                               (or vfont (face-font-name face '(default))))))
735                (setq vfont tv)
736                (xwem-set-face-font face tv tag-set domain))
737               ((eq tt :italic)
738                (if tv
739                    (setq tv (or (x-make-font-italic (or vfont (face-font-name face)))
740                                 (or vfont (face-font-name face '(default)))))
741                  (setq tv (or (x-make-font-unitalic (face-font-name face))
742                               (or vfont (face-font-name face '(default))))))
743                (setq vfont tv)
744                (xwem-set-face-font face tv tag-set domain)))
745         (setq vplist (cddr vplist)))
746       (setq spec (cdr spec)))))
747
748 (defun xwem-theme-apply (theme &optional domain)
749   "Apply theme to DOMAIN.
750 If DOMAIN is omitted, apply THEME globally."
751   (mapc #'(lambda (tspec)
752             (case (car tspec)
753               (face
754                (when (find-face (cadr tspec))
755                  (xwem-theme-apply-face-spec (cadr tspec) (caddr tspec) domain)))
756
757               (frame-property
758                (if (and domain (xwem-frame-p domain))
759                    (xwem-frame-set-property domain (cadr tspec) (caddr tspec))
760                  (mapc #'(lambda (f)
761                            (xwem-frame-set-property f (cadr tspec) (caddr tspec)))
762                        (xwem-frames-list))))
763
764               (client-property
765                (if (and domain (xwem-cl-p domain))
766                    (xwem-client-set-property domain (cadr tspec) (caddr tspec))
767                  (mapc #'(lambda (c)
768                            (xwem-client-set-property c (cadr tspec) (caddr tspec)))
769                        (xwem-clients-list))))
770
771               (custom
772                (customize-set-variable (cadr tspec) (caddr tspec)))))
773         theme))
774
775 ;;;###autoload(autoload 'xwem-theme-set "xwem-theme" nil t)
776 (define-xwem-command xwem-theme-set (theme &optional domain)
777   "Interactively set theme."
778   (xwem-interactive
779    (list (xwem-completing-read
780           "XWEM Theme [default]: "
781           (mapcar #'(lambda (el)
782                       (last (split-string (symbol-name el) "-")))
783                   xwem-theme-themes)
784           nil t)
785          (xwem-completing-read
786           "XWEM Domain [global]: "
787           '(("client") ("window") ("frame"))
788           nil t)))
789
790   ;; Fix theme
791   (if (string= "" theme)
792       (setq theme xwem-theme-default)
793     (setq theme (symbol-value (intern (concat "xwem-theme-" theme)))))
794
795   ;; Fix domain
796   (cond ((string= "client" domain)
797          (setq domain (xwem-cl-selected)))
798         ((string= "window" domain)
799          (setq domain (xwem-win-selected)))
800         ((string= "frame" domain)
801          (setq domain (xwem-frame-selected)))
802         (t (setq domain nil)))
803
804   (xwem-theme-apply theme domain))
805
806 \f
807 (provide 'xwem-theme)
808
809 ;;; xwem-theme.el ends here