;;; real-mono-themes.el --- Real monochromatic color themes -*- lexical-binding: t; -*-

;; Copyright (C) 2025 Qingsong Liao

;; Author: Qingsong Liao <llqingsong@qq.com>
;; Maintainer: Qingsong Liao <llqingsong@qq.com>
;; URL: https://github.com/NestorLiao/real-mono-themes
;; Created: 15th Nov 2025
;; Package-Version: 20251126.803
;; Package-Revision: 45d68036bce5
;; Keywords: faces
;; Package-Requires: ((emacs "28.1"))

;; This file 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.

;; This file 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 this file.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; A suite of real monochrome Emacs themes

;;; Code:

(defconst real-mono-themes-colors
  '((eink . ((background . "#ffffff")
	          (foreground . "#000000")))

    (dark . ((background . "#000000")
	          (foreground . "#ffffff")))

    (girl .  ((background . "#ffaeb9")
	          (foreground . "#8b636c")))

    (old . ((background . "#050505")
	        (foreground . "#7cfc00")))

    (sea . ((background . "#20b2aa")
	        (foreground . "#f4a460")))))

(defmacro real-mono-themes--variant-with-colors (variant &rest body)
  "Execute BODY in a scope where the different colors for given VARIANT is bound."
  `(let* ((colors (or (cdr (assoc ,variant real-mono-themes-colors))
		              (error "No such theme variant")))
	      (background (cdr (assoc 'background colors)))
	      (foreground (cdr (assoc 'foreground colors))))
     ,@body))

(defmacro real-mono-themes--faces-spec ()
  "Provide the faces specification."
  (quote
   (mapcar
    (lambda (entry) (list (car entry) `((t ,@(cdr entry)))))
    `(
(avy-lead-face (:inverse-video t :inherit (bold)))
(avy-lead-face-0 (:inverse-video t))
(avy-lead-face-1 (:inverse-video t))
(avy-lead-face-2 (:inverse-video t))
(blink-matching-paren-offscreen nil)
(bold (:weight bold))
(bookmark-face nil)
(button (:box (:line-width (1 . -1) :color ,foreground :style released-button)))
(company-echo-common nil)
(company-scrollbar-bg nil)
(company-scrollbar-fg nil)
(company-tooltip nil)
(company-tooltip-annotation (:italic t))
(company-tooltip-annotation-selection (:italic t))
(company-tooltip-common (:bold t))
(company-tooltip-common-selection (:bold t))
(company-tooltip-selection nil)
(company-tooltip-selection nil)
(compilation-error (:inherit error))
(compilation-info nil)
(compilation-mode-line-exit nil)
(compilation-mode-line-fail (:inherit error))
(compilation-mode-line-run (:inherit warning))
(compilation-warning (:inherit warning))
(completions-common-part nil)
(completions-highlight (:inherit highlight))
(consult-async-finished (:inherit success))
(consult-separator nil)
(corfu-annotations nil)
(corfu-bar (:inverse-video t))
(corfu-border (:inverse-video t))
(corfu-current (:underline t))
(corfu-default nil)
(custom-button (:inherit button))
(custom-button-mouse (:inherit button))
(custom-button-pressed (:inherit button))
(custom-changed (:inverse-video t))
(custom-comment nil)
(custom-group-tag-1 (:inherit variable-pitch :weight bold :height 1.2))
(custom-invalid (:inverse-video t))
(custom-link (:inherit (link)))
(custom-rogue (:inverse-video t))
(custom-state nil)
(custom-variable-tag (:inherit bold))
(default (:background ,background :foreground ,foreground))
(diary nil)
(diff-added nil)
(diff-changed-unspecified nil)
(diff-error (:inherit (pyim-page bold error)))
(diff-file-header :inherit bold)
(diff-function (:inherit (bold)))
(diff-header (:inherit bold))
(diff-index (:inherit bold))
(diff-indicator-added nil)
(diff-indicator-changed (:inherit diff-changed))
(diff-indicator-removed nil)
(diff-refine-added (:underline (:color foreground-color :style dots :position nil) :weight bold))
(diff-refine-changed nil)
(diff-refine-removed (:inherit region))
(diff-removed nil)
(dired-async-failures (:inherit error))
(dired-async-message (:inherit success))
(dired-async-mode-message (:inherit warning))
(dired-broken-symlink (:inverse-video t :inherit (bold link)))
(dired-directory (:inherit bold))
(dired-mark (:inverse-video t))
(dired-marked nil)
(dired-subtree-depth-1-face nil)
(dired-subtree-depth-2-face nil)
(dired-subtree-depth-3-face nil)
(dired-subtree-depth-4-face nil)
(edebug-disabled-breakpoint (:extend t :underline (:color foreground-color :style double-line :position nil)))
(eglot-highlight-symbol-face nil)
(elisp-shorthand-font-lock-face nil)
(elisp-symbol-at-mouse nil)
(elisp-unknown-call nil)
(envrc-mode-line-error-face (:inherit error))
(envrc-mode-line-none-face nil)
(envrc-mode-line-on-face nil)
(epa-mark (:inherit (button bold)))
(error nil)
(escape-glyph nil)
(eshell-ls-archive (:inherit eshell-ls-unreadable))
(eshell-ls-backup (:inherit eshell-ls-unreadable))
(eshell-ls-clutter (:inherit eshell-ls-unreadable))
(eshell-ls-directory (:bold t))
(eshell-ls-executable (:inherit eshell-ls-unreadable))
(eshell-ls-missing (:inherit eshell-ls-unreadable))
(eshell-ls-product (:inherit eshell-ls-unreadable))
(eshell-ls-readonly (:inherit eshell-ls-unreadable))
(eshell-ls-special (:inherit eshell-ls-unreadable))
(eshell-ls-symlink (:inherit eshell-ls-unreadable))
(eshell-prompt (:bold t))
(eshell-prompt (:inherit bold))
(eww-form-checkbox (:inherit (box)))
(eww-form-file (:inherit (box)))
(eww-form-select (:inherit (box)))
(eww-form-submit (:inherit (box)))
(eww-form-text (:inherit (box)))
(eww-form-textarea (:inherit (box)))
(eww-valid-certificate (:weight bold))
(fixed-pitch nil)
(fixed-pitch-serif nil)
(flycheck-error (:inherit error))
(flycheck-warning (:inherit warning))
(flymake-error nil)
(flymake-note nil)
(flymake-warning nil)
(font-lock-bracket-face nil)
(font-lock-builtin-face nil)
(font-lock-comment-delimiter-face nil)
(font-lock-comment-face nil)
(font-lock-constant-face nil)
(font-lock-delimiter-face nil)
(font-lock-doc-face nil)
(font-lock-doc-markup-face nil)
(font-lock-escape-face nil)
(font-lock-function-call-face nil)
(font-lock-function-name-face nil)
(font-lock-keyword-face nil)
(font-lock-misc-punctuation-face nil)
(font-lock-negation-char-face nil)
(font-lock-number-face nil)
(font-lock-operator-face nil)
(font-lock-preprocessor-face nil)
(font-lock-property-name-face nil)
(font-lock-property-use-face nil)
(font-lock-punctuation-face nil)
(font-lock-reference-face nil)
(font-lock-regexp-grouping-backslash nil)
(font-lock-regexp-grouping-construct nil)
(font-lock-string-face nil)
(font-lock-type-face nil)
(font-lock-variable-name-face (:underline nil))
(font-lock-variable-use-face nil)
(font-lock-warning-face nil)
(forge-dimmed (:inherit magit-dimmed))
(forge-pullreq-merged nil)
(forge-pullreq-open nil)
(forge-pullreq-rejected (:strike-through t))
(forge-topic-slug-saved (:weight bold))
(fringe nil)
(git-gutter:added nil)
(git-gutter:deleted nil)
(git-gutter:modified nil)
(gnus-group-mail-1 (:weight bold))
(gnus-group-mail-2 (:weight bold))
(gnus-group-mail-3 (:weight bold))
(gnus-group-mail-4 (:weight bold))
(gnus-group-news-1 (:weight bold))
(gnus-group-news-2 (:weight bold))
(gnus-group-news-3 (:weight bold))
(gnus-group-news-4 (:weight bold))
(gnus-header-content nil)
(gnus-header-from nil)
(gnus-header-name nil)
(gnus-header-subject nil)
(gnus-splash nil)
(gnus-summary-high-undownloaded (:weight bold))
(go-coverage-10 nil)
(go-coverage-covered nil)
(go-coverage-untracked (:inverse-video t))
(header-line nil)
(help-key-binding (:inherit (fixed-pitch button)))
(highlight (:weight bold))
(hl-todo (:weight bold))
(holiday nil)
(homoglyph nil)
(icon-button (:inherit (button icon)))
(ido-first-match (:bold t))
(ido-first-match nil)
(ido-only-match (:bold t))
(ido-only-match nil)
(ido-subdir (:italic t))
(ido-subdir nil)
(ido-vertical-match-face (:bold t))
(ido-virtual nil)
(iedit-occurrence nil)
(info-index-match nil)
(info-menu-header (:inherit variable-pitch))
(info-menu-star nil)
(info-node nil)
(info-title-1 nil)
(info-title-2 nil)
(info-title-3 nil)
(info-title-4 (:inherit variable-pitch))
(info-xref nil)
(info-xref-visited nil)
(isearch nil)
(isearch-fail nil)
(italic (:slant italic))
(lazy-highlight (:weight bold))
(line-number-major-tick (:weight bold))
(link nil)
(link-visited (:inherit link))
(magit-bisect-bad (:inherit (italic)))
(magit-bisect-good (:inherit bold))
(magit-bisect-skip nil)
(magit-blame-dimmed (:inherit (magit-dimmed)))
(magit-blame-heading (:inherit button))
(magit-blame-highlight nil)
(magit-blame-margin (:inherit (warning)))
(magit-branch-current (:weight bold :inherit italic))
(magit-branch-local (:inherit (italic)))
(magit-branch-remote (:inherit bold))
(magit-cherry-equivalent nil)
(magit-cherry-unmatched (:inherit (italic)))
(magit-diff-added nil)
(magit-diff-added-highlight nil)
(magit-diff-base nil)
(magit-diff-base-highlight (:inherit (italic)))
(magit-diff-context nil)
(magit-diff-context-highlight nil)
(magit-diff-file-heading-selection nil)
(magit-diff-hunk-heading (:inherit (italic)))
(magit-diff-hunk-heading-highlight (:inherit italic))
(magit-diff-hunk-heading-selection nil)
(magit-diff-lines-heading (:inherit button))
(magit-diff-refine-added (:inherit diff-refine-added))
(magit-diff-refine-removed (:inherit diff-refine-removed))
(magit-diff-removed nil)
(magit-diff-removed-highlight nil)
(magit-diffstat-added (:inherit bold))
(magit-diffstat-removed nil)
(magit-dimmed (:weight light))
(magit-hash (:inherit (italic)))
(magit-header (:inherit bold))
(magit-item-highlight (:inherit bold))
(magit-item-mark nil)
(magit-log-author (:inherit bold))
(magit-log-date nil)
(magit-log-graph nil)
(magit-process-ng (:inherit (bold button)))
(magit-process-ok (:inherit (bold button)))
(magit-reflog-amend (:inherit (italic)))
(magit-reflog-checkout (:inherit bold))
(magit-reflog-cherry-pick nil)
(magit-reflog-commit (:inherit bold))
(magit-reflog-merge (:inherit (italic bold)))
(magit-reflog-other nil)
(magit-reflog-rebase (:inherit (italic)))
(magit-reflog-remote (:inherit bold))
(magit-reflog-reset nil)
(magit-refname nil)
(magit-section-heading (:inherit bold))
(magit-section-heading-selection nil)
(magit-section-highlight nil)
(magit-sequence-drop (:inherit (italic)))
(magit-sequence-head (:inherit bold))
(magit-sequence-part (:inherit (italic)))
(magit-sequence-stop (:inherit button))
(magit-signature-bad (:inherit (italic bold)))
(magit-signature-error (:inherit error))
(magit-signature-expired nil)
(magit-signature-good (:inherit bold))
(magit-signature-revoked (:inherit (italic)))
(magit-signature-untrusted nil)
(magit-tag (:inherit (button bold)))
(marginalia-documentation nil)
(markdown-highlighting-face nil)
(match (:inherit bold))
(message-header-name nil)
(message-header-other nil)
(message-header-to (:inherit bold))
(message-mml nil)
(minibuffer-depth-indicator nil)
(minibuffer-nonselected (:inherit bold))
(minibuffer-prompt nil)
(mmm-default-submode-face nil)
(mode-line nil)
(mode-line-buffer (:inherit bold))
(mode-line-buffer-id nil)
(mode-line-emphasis nil)
(mode-line-highlight nil)
(mode-line-inactive nil)
(mode-line-minor-mode (:weight light))
(next-error (:inherit error))
(nlinum-relative-current-face (:inherit normal :weight bold))
(nobreak-hyphen nil)
(orderless-match-face-0 (:underline t))
(orderless-match-face-1 (:underline t))
(orderless-match-face-2 (:underline t))
(orderless-match-face-3 (:underline t))
(org-agenda-current-time nil)
(org-agenda-date (:height 1.2))
(org-agenda-date-today (:weight bold :height 1.4))
(org-agenda-date-weekend (:weight regular))
(org-agenda-dimmed-todo-face (:inherit dimmed))
(org-agenda-restriction-lock nil)
(org-agenda-structure nil)
(org-block nil)
(org-clock-overlay nil)
(org-column (:inverse-video t))
(org-column-title (:inverse-video t :weight bold))
(org-date nil :underline)
(org-date-selected (:inverse-video t))
(org-dispatcher-highlight (:weight bold))
(org-done nil)
(org-ellipsis (:underline t))
(org-formula nil)
(org-headline-done nil)
(org-headline-todo nil)
(org-latex-and-related nil)
(org-level-1 nil)
(org-level-2 nil)
(org-level-3 nil)
(org-level-4 nil)
(org-level-5 nil)
(org-level-6 nil)
(org-macro nil)
(org-mode-line-clock-overrun (:inverse-video t))
(org-quote (:inverse-video t :inherit intalic))
(org-scheduled nil)
(org-scheduled-previously nil)
(org-scheduled-today nil)
(org-sexp-date nil)
(org-special-keyword nil)
(org-table (:height 0.8))
(org-table-header nil)
(org-todo nil)
(org-upcoming-deadline nil)
(org-verbatim (:weight bold))
(org-verse (:inherit italic))
(package-mark-delete-line (:inherit diff-refine-removed))
(package-mark-install-line (:underline t))
(pdf-links-read-link (:inverse-video t ink))
(pyim-page (:inverse-video t))
(pyim-page-border (:inverse-video t))
(pyim-page-border nil)
(pyim-page-selection nil)
(pyim-preview-face nil)
(query-replace nil)
(reb-match-0 (:underline t))
(reb-match-1 (:underline (:color foreground-color :style double-line :position nil)))
(reb-match-2 (:underline (:color foreground-color :style dots :position nil)))
(reb-match-3 (:underline (:color foreground-color :style dashes :position nil)))
(region (:underline (:color foreground-color :style double-line :position nil)))
(rxt-highlight-face (:underline t))
(secondary-selection (:inherit diff-refine-removed))
(separator-line (:height 0.1))
(sh-heredoc nil)
(sh-quoted-exec nil)
(shadow nil)
(show-paren-match nil)
(show-paren-match-expression nil)
(show-paren-mismatch nil)
(shr-abbreviation nil)
(shr-code nil)
(shr-h1 nil)
(shr-h2 nil)
(shr-h3 nil)
(shr-h4 nil)
(shr-h5 nil)
(shr-h6 nil)
(shr-link (:inherit (link)))
(shr-mark nil)
(shr-selected-link nil)
(shr-sliced-image nil)
(shr-strike-through nil)
(shr-sup nil)
(shr-text nil)
(smerge-markers (:extend t :underline (:color foreground-color :style wave :position nil)))
(smerge-refined-added (:inherit magit-dimmed))
(smerge-refined-removed (:inherit diff-refine-added))
(success (:inherit bold))
(tab-bar (:inherit variable-pitch))
(tab-bar-tab-highlight (:inherit button))
(tab-bar-tab-inactive nil)
(tab-bar-tab-ungrouped nil)
(tab-line (:inherit variable-pitch))
(tab-line-highlight (:inherit button))
(tldr-code-block nil)
(tldr-command-argument nil)
(tldr-command-itself nil)
(tldr-description nil)
(tldr-introduction nil)
(tldr-title (:inherit bold))
(tool-bar (:inherit button))
(tooltip (:inherit variable-pitch))
(trailing-whitespace (:inverse-video t))
(transient-argument (:weight bold))
(transient-disabled-suffix nil)
(transient-enabled-suffix (:inherit bold))
(transient-heading nil)
(transient-key nil)
(transient-key-exit nil)
(transient-key-noop nil)
(transient-key-recurse nil)
(transient-key-return nil)
(transient-key-stack nil)
(transient-key-stack nil)
(transient-key-stay nil)
(transient-mismatched-key (:underline t))
(transient-nonstandard-key (:underline t))
(transient-pink (:weight bold))
(transient-purple (:weight bold))
(transient-red (:weight bold))
(transient-teal (:weight bold))
(transient-unreachable nil)
(transient-unreachable-key nil)
(transient-value nil)
(transient-value nil)
(variable-pitch nil)
(vertico-current (:inherit italic))
(warning nil)
(wgrep-delete-face (:inherit diff-refine-removed))
(wgrep-done-face nil)
(wgrep-face nil)
(wgrep-file-face (:inverse-video t))
(wgrep-reject-face (:underline (:color foreground-color :style wave :position nil) :weight bold))
(whitespace-line nil)
(widget-documentation nil)
(widget-field (:inherit button))
(widget-single-line-field nil)
(window-divider nil)
(window-divider-first-pixel nil)
(window-divider-last-pixel nil)))))

(defun real-mono-themes--variant-name (variant)
  "Create symbol for color theme variant VARIANT."
  (intern (format "real-mono-%s" (symbol-name variant))))

(defmacro real-mono-themes--define-theme (variant)
  "Define a theme for the real-mono variant VARIANT."
  (let ((name (real-mono-themes--variant-name variant))
        (doc (format "real mono theme (%s version)" variant)))
    `(progn
       (deftheme ,name ,doc)
       (put ',name 'theme-immediate t)
       (real-mono-themes--variant-with-colors
        ',variant
        (apply #'custom-theme-set-faces ',name
               (real-mono-themes--faces-spec)))
       (provide-theme ',name))))

;;;###autoload
(when (and (boundp 'custom-theme-load-path) load-file-name)
  (add-to-list 'custom-theme-load-path
	           (file-name-as-directory (file-name-directory load-file-name))))

(provide 'real-mono-themes)

;;; real-mono-themes.el ends here
