aboutsummaryrefslogtreecommitdiff
path: root/bard-elisp/bard-theme.el
blob: fb90c85945e4b6e859b5ec246defd06ae858f485 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
(setq fontaine-presets
        '((default
           :default-height 160
           :default-family "Iosevka Comfy"
           :variable-pitch-family "Iosevka Comfy Motion"
           :variable-pitch-height 1.0
           :fixed-pitch-family "Iosevka Comfy"
           :fixed-pitch-height 1.0
           :bold-weight bold
           :mode-line-active-family "Iosevka Comfy Motion"
           :mode-line-inactive-family "Iosevka Comfy Motion"
           :mode-line-active-height 160
           :mode-line-inactive-height 160
           )
          (mixed
           :inherit default
           :variable-pitch-family "Iosevka Comfy Wide Motion Duo")
          (wide
           :inherit default
           :default-height 150
           :default-family "Iosevka Comfy Wide"
           :fixed-pitch-family "Iosevka Comfy Wide"
           :mode-line-active-family "Iosevka Comfy Wide Motion Duo"
           :mode-line-inactive-family "Iosevka Comfy Wide Motion Duo"
           :variable-pitch-family "Iosevka Comfy Wide Motion Duo"
           :mode-line-active-height 150
           :mode-line-inactive-height 150)
          (large
           :inherit default
           :variable-pitch-family "Iosevka Comfy Wide Motion"
           :default-height 170
           :mode-line-active-height 150
           :mode-line-inactive-height 150
           )
          (huge
           :inherit default
           :variable-pitch-family "Iosevka Comfy Wide Motion"
           :default-height 200
           :mode-line-active-height 170
           :mode-line-inactive-height 170
           )
          (comic
           :inherit default
           :default-family "Comic Code"
           :variable-pitch-family "Comic Code"
           :fixed-pitch-family "Comic Code"
           :mode-line-active-family "Comic Code"
           :mode-line-inactive-family "Comic Code"
           )
          (writing
           :inherit default
           :variable-pitch-family "Lora")
          (bit
           :inherit default
           :default-height 180
           :mode-line-active-height 180
           :mode-line-inactive-height 180
           :default-family "Terminus"
           :variable-pitch-family "Terminus"
           :fixed-pitch-family "Terminus"
           :mode-line-active-family "Terminus"
           :mode-line-inactive-family "Terminus"
           )
          (t
           :default-family "Monospace"
           )))

;; Switching themes
(defun bard/disable-all-themes ()
  "disable all active themes."
  (interactive)
  (dolist (i custom-enabled-themes)
    (disable-theme i)))

(defvar bard/after-theme-load-hook nil
  "Hook that runs after a new theme is loaded using `bard/select-theme`.")

(dolist (hook '(enable-theme-hook))
  (add-hook hook #'fontaine-apply-current-preset)
  (add-hook hook #'logos-update-fringe-in-buffers))

(add-to-list 'enable-theme-functions #'logos-update-fringe-in-buffers)

(add-to-list 'enable-theme-functions #'fontaine-apply-current-preset)

(defun bard/select-theme ()
  "Prompt the user to select a theme from all available custom themes and enable it."
  (interactive)
  (let* ((theme (completing-read "Select theme: " (mapcar 'symbol-name (custom-available-themes))))
         (theme-symbol (intern theme))
         (theme-name (if (string-suffix-p "-theme" theme)
                         (substring theme 0 -6)
                       theme))
         (colored-theme-name (propertize theme-name 'face '(:weight bold))))
    (bard/disable-all-themes)
    (load-theme theme-symbol t)
    (message "Loaded the %s theme" colored-theme-name)
    (run-hooks 'after-theme-load-hook)))


(provide 'bard-theme)