;;; 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 . ;;; 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)