main
  1;;; modus-alabaster-bg.el --- Alabaster BG colours on top of Modus themes -*- lexical-binding: t -*-
  2
  3;; Author: Vincent Demeester
  4;; Based on: https://github.com/tonsky/sublime-scheme-alabaster (Alabaster BG variant)
  5;;           https://github.com/dpassen/modus-alabaster
  6;; Package-Requires: ((emacs "28.1") (modus-themes "5.0.0"))
  7;; Keywords: faces, theme, accessibility
  8
  9;;; Commentary:
 10;;
 11;; Alabaster BG variant: uses background washes instead of foreground
 12;; colors for syntax highlighting.  Strings get a green background,
 13;; comments get a yellow background, definitions get a blue background.
 14;; Only constants keep a distinct foreground color.
 15
 16;;; Code:
 17
 18(require 'modus-themes)
 19
 20(defconst modus-alabaster-bg-common-palette-mappings
 21  '(
 22    ;; BG variant: most syntax gets fg-main foreground; the background
 23    ;; washes are applied via custom faces below.
 24    (keyword          fg-main)
 25    (builtin          fg-main)
 26    (constant         alabaster-bg-constant)
 27    (string           fg-main)
 28    (docstring        fg-main)
 29    (docmarkup        fg-main)
 30    (comment          fg-main)
 31    (fnname           fg-main)
 32    (fnname-call      fg-main)
 33    (type             fg-main)
 34    (variable         fg-main)
 35    (variable-use     fg-main)
 36    (preprocessor     fg-main)
 37    (property         fg-main)
 38    (rx-backslash     fg-main)
 39    (rx-construct     fg-main)
 40    (number           alabaster-bg-constant)
 41    (punctuation      alabaster-bg-punctuation)
 42    (operator         alabaster-bg-operator)
 43    (bracket          alabaster-bg-bracket)
 44    (delimiter        alabaster-bg-punctuation)
 45
 46    ;; Links
 47    (fg-link                 alabaster-bg-active)
 48    (underline-link          alabaster-bg-active)
 49    (fg-link-symbolic        alabaster-bg-active)
 50    (underline-link-symbolic alabaster-bg-active)
 51    (fg-link-visited         alabaster-bg-constant)
 52    (underline-link-visited  alabaster-bg-constant)
 53
 54    ;; Prose — quiet, but keep status indicators visible
 55    (fg-prose-code        fg-main)
 56    (fg-prose-macro       fg-main)
 57    (fg-prose-verbatim    fg-main)
 58    (prose-done           fg-main)
 59    (prose-todo           fg-main)
 60    (prose-tag            fg-dim)
 61    (prose-metadata       fg-dim)
 62    (prose-metadata-value fg-dim)
 63    (fg-heading-0         fg-main)
 64    (fg-heading-1         fg-main)
 65    (fg-heading-2         fg-main)
 66    (fg-heading-3         fg-main)
 67    (fg-heading-4         fg-main)
 68    (fg-heading-5         fg-main)
 69    (fg-heading-6         fg-main)
 70    (fg-heading-7         fg-main)
 71    (fg-heading-8         fg-main)
 72
 73    ;; Completion
 74    (accent-0              alabaster-bg-active)
 75    (accent-1              alabaster-bg-constant)
 76    (accent-2              fg-main)
 77    (accent-3              fg-main)
 78    (fg-completion-match-0 alabaster-bg-active)
 79    (fg-completion-match-1 alabaster-bg-constant)
 80    (fg-completion-match-2 fg-main)
 81    (fg-completion-match-3 fg-main)
 82    (fg-prompt             alabaster-bg-active)
 83
 84    ;; Diagnostics
 85    (modeline-err     alabaster-bg-error-fg)
 86    (modeline-warning alabaster-bg-error-fg)
 87    (modeline-info    alabaster-bg-active)
 88    (err               alabaster-bg-error-fg)
 89    (warning           alabaster-bg-error-fg)
 90    (info              alabaster-bg-active)
 91    (underline-err     alabaster-bg-error-fg)
 92    (underline-warning alabaster-bg-error-fg)
 93    (underline-note    alabaster-bg-active)
 94
 95    (keybind    alabaster-bg-active)
 96    (name       fg-main)
 97    (identifier alabaster-bg-constant)
 98
 99    ;; Dates
100    (date-common           fg-main)
101    (date-deadline         alabaster-bg-error-fg)
102    (date-deadline-subtle  alabaster-bg-error-fg)
103    (date-scheduled        fg-main)
104    (date-scheduled-subtle fg-main)
105    (date-holiday          fg-main)
106    (date-holiday-other    fg-main)
107    (date-weekday          fg-main)
108    (date-weekend          fg-main)
109
110    ;; Mail — minimal
111    (mail-cite-0    fg-main)
112    (mail-cite-1    fg-main)
113    (mail-cite-2    fg-main)
114    (mail-cite-3    fg-main)
115    (mail-part      fg-main)
116    (mail-recipient fg-main)
117    (mail-subject   fg-main)
118    (mail-other     fg-main))
119  "Common palette mappings for the Alabaster BG Modus themes.")
120
121(defcustom modus-alabaster-bg-common-palette-overrides nil
122  "Palette overrides shared by all Modus Alabaster BG themes."
123  :group 'modus-themes
124  :type '(repeat (list symbol (choice symbol string))))
125
126;;;; Theme declaration and registration
127
128(defconst modus-alabaster-bg-with-properties
129  '((modus-alabaster-bg-light modus-alabaster-bg "Alabaster BG light palette on modus-operandi." light modus-themes-operandi-palette modus-alabaster-bg-light-palette modus-alabaster-bg-light-palette-overrides)
130    (modus-alabaster-bg-dark modus-alabaster-bg "Alabaster BG dark palette on modus-vivendi." dark modus-themes-vivendi-palette modus-alabaster-bg-dark-palette modus-alabaster-bg-dark-palette-overrides)
131    (modus-tonski-bg-light modus-alabaster-bg "Tonski BG light palette on modus-operandi." light modus-themes-operandi-palette modus-tonski-bg-light-palette modus-tonski-bg-light-palette-overrides))
132  "Properties for each Modus Alabaster BG theme.")
133
134(defvar modus-alabaster-bg--declared-p nil
135  "Non-nil if Modus Alabaster BG themes have been declared.")
136
137(defun modus-alabaster-bg-declare-themes ()
138  "Declare and register the Modus Alabaster BG themes."
139  (unless modus-alabaster-bg--declared-p
140    (dolist (theme modus-alabaster-bg-with-properties)
141      (apply #'modus-themes-declare theme)
142      (modus-themes-register (car theme)))
143    (setq modus-alabaster-bg--declared-p t)))
144
145(modus-alabaster-bg-declare-themes)
146
147;;;; Convenience commands
148
149;;;###autoload (autoload 'modus-alabaster-bg-toggle "modus-alabaster-bg")
150(modus-themes-define-derivative-command modus-alabaster-bg toggle)
151
152;;;###autoload (autoload 'modus-alabaster-bg-rotate "modus-alabaster-bg")
153(modus-themes-define-derivative-command modus-alabaster-bg rotate)
154
155;;;###autoload (autoload 'modus-alabaster-bg-select "modus-alabaster-bg")
156(modus-themes-define-derivative-command modus-alabaster-bg select)
157
158(provide 'modus-alabaster-bg)
159;;; modus-alabaster-bg.el ends here