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
| | ;;; pgtk-theme.el --- GTK theme support for GNU Emacs. -*- lexical-binding: t -*-
;; Copyright (C) 2020 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; This package provides some crude GTK theme integration for GNU Emacs.
;;; Code:
(unless (and (or (string-prefix-p "3.98" gtk-version-string)
(string-prefix-p "4." gtk-version-string))
(window-system))
(error "Trying to load gtk-theme.el on an incompatible terminal"))
(require 'subr-x)
(deftheme gtk
"The system GTK theme.")
(let ((class '((class color) (min-colors 89))))
(custom-theme-set-faces
'gtk
`(default ((,class (:foreground
"gtk-style-foreground"
:background
"gtk-style-background"
:family
,(pgtk-default-font-family t)))))
`(variable-pitch ((,class (:family ,(pgtk-default-font-family nil)))))
`(mode-line ((,class (:foreground
"gtk-style-modeline-foreground"
:background
"gtk-style-modeline-background"))))
`(region ((,class (:foreground
"gtk_selection_fg_color"
:background
"gtk_selection_bg_color"))))
`(link ((,class (:foreground "gtk-style-link-foreground"
:underline t))))
`(custom-button ((,class (:foreground "gtk-style-foreground"
:box (:line-width 5 :style gtk-released-button)))))
`(eww-form-submit ((,class (:foreground "gtk-style-foreground"
:box (:line-width 5 :style gtk-released-button)))))
`(custom-button-mouse ((,class (:foreground "gtk-style-foreground"
:box (:line-width 5 :style gtk-prelight-button)))))
`(custom-button-pressed ((,class (:foreground "gtk-style-foreground"
:box (:line-width 5 :style gtk-pressed-button)))))
`(widget-field ((,class (:foreground "gtk-style-foreground"
:box (:line-width 5 :style gtk-selected-entry)))))
`(widget-button ((,class (:foreground "gtk-style-foreground"
:box (:line-width 5 :style gtk-released-button)))))
`(link-visited ((,class (:foreground "gtk-style-slink-foreground"
:underline t))))
`(tab-bar ((,class (:foreground "gtk-style-modeline-foreground"
:background "gtk-style-tb-background"))))
`(org-checkbox ((,class (:foreground "gtk-style-foreground"
:box (:line-width 5 :style gtk-unchecked-checkbox)))))))
(custom-theme-set-variables
'gtk '(cursor-type `(bar . ,(pgtk-get-text-caret-width)))
'(pgtk-flat-underwave-style t)
'(window-divider-default-right-width (pgtk-get-separator-width))
'(window-divider-default-bottom-width (pgtk-get-separator-width)))
;;;###autoload
(when (and (boundp 'custom-theme-load-path)
load-file-name)
;; add theme folder to `custom-theme-load-path' when installing over MELPA
(add-to-list 'custom-theme-load-path
(file-name-as-directory (file-name-directory load-file-name))))
(provide-theme 'gtk)
;;; gtk-theme.el ends here
(provide 'gtk-theme)
|