;;; jao-custom-themes.el --- color themes based on modus-themes  -*- lexical-binding: t; -*-

;; Copyright (C) 2022  jao

;; Author: jao <mail@jao.io>
;; Keywords: faces, faces

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

;;; Commentary:

;; Color themes based on modus

;;; Code:

(use-package modus-themes
  :ensure t
  :demand t)

;;;; Customization
(setq modus-themes-italic-constructs t
      modus-themes-bold-constructs t
      modus-themes-mixed-fonts nil
      modus-themes-subtle-line-numbers t
      modus-themes-intense-mouseovers nil
      modus-themes-deuteranopia nil
      modus-themes-tabs-accented t
      modus-themes-variable-pitch-ui nil
      modus-themes-inhibit-reload nil

      modus-themes-fringes nil ; {nil,'subtle,'intense}

      ;; Options for `modus-themes-lang-checkers' are either nil (the
      ;; default), or a list of properties that may include any of those
      ;; symbols: `straight-underline', `text-also', `background',
      ;; `intense' OR `faint'.
      modus-themes-lang-checkers nil

      ;; Options for `modus-themes-mode-line' are either nil, or a list
      ;; that can combine any of `3d' OR `moody', `borderless',
      ;; `accented', a natural number for extra padding (or a cons cell
      ;; of padding and NATNUM), and a floating point for the height of
      ;; the text relative to the base font size (or a cons cell of
      ;; height and FLOAT)
      modus-themes-mode-line '(accented borderless)

      ;; Options for `modus-themes-markup' are either nil, or a list
      ;; that can combine any of `bold', `italic', `background',
      ;; `intense'.
      modus-themes-markup '(background)

      ;; Options for `modus-themes-syntax' are either nil (the default),
      ;; or a list of properties that may include any of those symbols:
      ;; `faint', `yellow-comments', `green-strings', `alt-syntax'
      modus-themes-syntax '(faint alt-syntax)

      ;; Options for `modus-themes-hl-line' are either nil (the default),
      ;; or a list of properties that may include any of those symbols:
      ;; `accented', `underline', `intense'
      modus-themes-hl-line nil

      ;; Options for `modus-themes-paren-match' are either nil (the
      ;; default), or a list of properties that may include any of those
      ;; symbols: `bold', `intense', `underline'
      modus-themes-paren-match '(bold)

      ;; Options for `modus-themes-links' are either nil (the default),
      ;; or a list of properties that may include any of those symbols:
      ;; `neutral-underline' OR `no-underline', `faint' OR `no-color',
      ;; `bold', `italic', `background'
      modus-themes-links '(neutral-underline)

      ;; Options for `modus-themes-box-buttons' are either nil (the
      ;; default), or a list that can combine any of `flat',
      ;; `accented', `faint', `variable-pitch', `underline',
      ;; `all-buttons', the symbol of any font weight as listed in
      ;; `modus-themes-weights', and a floating point number
      ;; (e.g. 0.9) for the height of the button's text.
      modus-themes-box-buttons '(flat)

      ;; Options for `modus-themes-prompts' are either nil (the
      ;; default), or a list of properties that may include any of those
      ;; symbols: `background', `bold', `gray', `intense', `italic'
      modus-themes-prompts nil

      ;; The `modus-themes-completions' is an alist that reads three
      ;; keys: `matches', `selection', `popup'.  Each accepts a nil
      ;; value (or empty list) or a list of properties that can include
      ;; any of the following (for WEIGHT read further below):
      ;;
      ;; `matches' - `background', `intense', `underline', `italic', WEIGHT
      ;; `selection' - `accented', `intense', `underline', `italic', `text-also', WEIGHT
      ;; `popup' - same as `selected'
      ;; `t' - applies to any key not explicitly referenced (check docs)
      ;;
      ;; WEIGHT is a symbol such as `semibold', `light', or anything
      ;; covered in `modus-themes-weights'.  Bold is used in the absence
      ;; of an explicit WEIGHT.
      modus-themes-completions
      '((matches . (regular))
        (selection . (regular accented))
        (popup . (regular accented)))

      modus-themes-mail-citations '(faint) ; {nil,'intense,'faint,'monochrome}

      ;; Options for `modus-themes-region' are either nil (the default),
      ;; or a list of properties that may include any of those symbols:
      ;; `no-extend', `bg-only', `accented'
      modus-themes-region nil

      ;; Options for `modus-themes-diffs': nil, 'desaturated, 'bg-only
      modus-themes-diffs 'desaturated

      modus-themes-org-blocks nil ; {nil,'gray-background,'tinted-background}

      modus-themes-org-agenda ; this is an alist: read the manual or its doc string
      '((header-block . (light 1.0))
        (header-date . (underline-today grayscale workaholic 1.0))
        (event . (accented italic varied))
        (scheduled . rainbow)
        (habit . simplified))

      ;; The `modus-themes-headings' is an alist with lots of possible
      ;; combinations, include per-heading-level tweaks: read the
      ;; manual or its doc string
      modus-themes-headings
      '((0 . (light))
        (1 . (rainbow light))
        (2 . (rainbow light))
        (3 . (rainbow regular))
        (4 . (rainbow regular))
        (5 . (rainbow))
        (t . (semibold))))

;;;; Loading themes
(modus-themes-load-themes)

(defun jao-colors-scheme-dark-p ()
  (equal "dark" (getenv "JAO_COLOR_SCHEME")))

(if (jao-colors-scheme-dark-p)
    (modus-themes-load-vivendi)
  (modus-themes-load-operandi))

;; (jao-mode-line-adjust-faces)

(provide 'jao-custom-themes)
;;; jao-custom-themes.el ends here