;;; camm4-theme.el --- A light theme based on the camm4 palette -*- lexical-binding: t; no-byte-compile: t; -*-

(deftheme camm4
  "Light theme with a calm, readable palette.
Core colours: blues (005FDB, 3B82F6, 007A8A, 40B7BF) and magenta (8A35B8, D33682).")

(let ((class '((class color) (min-colors 89)))
      ;; Basic palette
      (camm4-bg        "#fefcff")
      (camm4-fg        "#101010")
      (camm4-cursor    "#f04ceb")
      ;; ANSI colours (index 01-16)
      (camm4-black     "#E6EEFF")      ; 01 – very light blueish grey
      (camm4-red       "#C82829")      ; 02
      (camm4-green     "#419722")      ; 03
      (camm4-yellow    "#F48925")      ; 04
      (camm4-blue      "#005FDB")      ; 05 – core blue
      (camm4-magenta   "#EF89DF")      ; 06 – core purple
      (camm4-cyan      "#007A8A")      ; 07 – core teal/blue
      (camm4-white     "#4D4D4C")      ; 08 – dark grey
      (camm4-brblack   "#e2ecff")      ; 09
      (camm4-brred     "#E53935")      ; 10
      (camm4-brgreen   "#22A653")      ; 11
      (camm4-bryellow  "#FFA200")      ; 12
      (camm4-brblue    "#3B82F6")      ; 13 – core bright blue
      (camm4-brmagenta "#D33682")      ; 14 – core bright magenta
      (camm4-brcyan    "#40B7BF")      ; 15 – core bright teal
      (camm4-brwhite   "#1D1F21"))     ; 16 – near black

  (custom-theme-set-faces
   'camm4
   ;; Basic faces
   `(default ((,class (:background ,camm4-bg :foreground ,camm4-fg))))
   `(cursor ((,class (:background ,camm4-cursor))))
   `(fringe ((,class (:background ,camm4-bg :foreground ,camm4-white))))
   `(region ((,class (:background ,camm4-brblack :foreground ,camm4-fg))))
   `(highlight ((,class (:background ,camm4-brblack))))
   `(hl-line ((,class (:background ,camm4-brblack))))
   `(success ((,class (:foreground ,camm4-brgreen))))
   `(warning ((,class (:foreground ,camm4-bryellow))))
   `(error ((,class (:foreground ,camm4-brred :weight bold))))
   `(link ((,class (:foreground ,camm4-blue :underline t))))
   `(link-visited ((,class (:foreground ,camm4-magenta :underline t))))

   ;; Font lock (syntax highlighting)
   `(font-lock-builtin-face ((,class (:foreground ,camm4-cyan))))
   `(font-lock-comment-face ((,class (:foreground ,camm4-white :slant italic))))
   `(font-lock-comment-delimiter-face ((,class (:inherit font-lock-comment-face))))
   `(font-lock-constant-face ((,class (:foreground ,camm4-brblue))))
   `(font-lock-doc-face ((,class (:inherit font-lock-comment-face :foreground ,camm4-green))))
   `(font-lock-function-name-face ((,class (:foreground ,camm4-brmagenta :weight bold))))
   `(font-lock-keyword-face ((,class (:foreground ,camm4-blue :weight bold))))
   `(font-lock-negation-char-face ((,class (:foreground ,camm4-red))))
   `(font-lock-preprocessor-face ((,class (:foreground ,camm4-cyan))))
   `(font-lock-regexp-grouping-backslash ((,class (:foreground ,camm4-yellow))))
   `(font-lock-regexp-grouping-construct ((,class (:foreground ,camm4-red))))
   `(font-lock-string-face ((,class (:foreground ,camm4-red :weight semi-light))))
   `(font-lock-type-face ((,class (:foreground ,camm4-brcyan :weight normal))))
   `(font-lock-variable-name-face ((,class (:foreground ,camm4-magenta))))
   `(font-lock-warning-face ((,class (:foreground ,camm4-brred :weight bold))))

   ;; Mode line
   `(mode-line ((,class (:background ,camm4-black :foreground ,camm4-fg :box (:line-width 1 :color ,camm4-white)))))
   `(mode-line-inactive ((,class (:background ,camm4-brblack :foreground ,camm4-white :box (:line-width 1 :color ,camm4-brblack)))))
   `(mode-line-buffer-id ((,class (:weight bold :foreground ,camm4-brblue))))
   `(mode-line-emphasis ((,class (:weight bold))))
   `(mode-line-highlight ((,class (:box (:line-width 1 :color ,camm4-brblue)))))

   ;; Minibuffer, completion, etc.
   `(minibuffer-prompt ((,class (:foreground ,camm4-blue :weight bold))))
   `(completions-common-part ((,class (:foreground ,camm4-fg))))
   `(completions-first-difference ((,class (:foreground ,camm4-brred :weight bold))))

   ;; Search
   `(isearch ((,class (:background ,camm4-bryellow :foreground ,camm4-fg))))
   `(isearch-fail ((,class (:background ,camm4-red :foreground ,camm4-bg))))
   `(lazy-highlight ((,class (:background ,camm4-yellow :foreground ,camm4-fg :underline t))))

   ;; Line numbers
   `(line-number ((,class (:foreground ,camm4-white :background ,camm4-bg))))
   `(line-number-current-line ((,class (:foreground ,camm4-blue :weight bold :background ,camm4-brblack))))

   ;; Dired
   `(dired-header ((,class (:foreground ,camm4-blue :weight bold))))
   `(dired-directory ((,class (:foreground ,camm4-brblue :weight bold))))
   `(dired-symlink ((,class (:foreground ,camm4-cyan :slant italic))))

   ;; Org mode
   `(org-level-1 ((,class (:foreground ,camm4-brblue :weight bold :height 1.2))))
   `(org-level-2 ((,class (:foreground ,camm4-blue :weight bold :height 1.1))))
   `(org-level-3 ((,class (:foreground ,camm4-cyan :weight bold))))
   `(org-level-4 ((,class (:foreground ,camm4-magenta :weight bold))))
   `(org-level-5 ((,class (:foreground ,camm4-brcyan :weight bold))))
   `(org-level-6 ((,class (:foreground ,camm4-brmagenta :weight bold))))
   `(org-todo ((,class (:foreground ,camm4-brred :weight bold :box t))))
   `(org-done ((,class (:foreground ,camm4-brgreen :weight bold :box t))))
   `(org-date ((,class (:foreground ,camm4-brblue :underline t))))
   `(org-link ((,class (:foreground ,camm4-blue :underline t))))
   `(org-tag ((,class (:foreground ,camm4-white :weight normal))))

   ;; Markdown
   `(markdown-header-face-1 ((,class (:inherit org-level-1))))
   `(markdown-header-face-2 ((,class (:inherit org-level-2))))
   `(markdown-header-face-3 ((,class (:inherit org-level-3))))
   `(markdown-link-face ((,class (:inherit link))))
   `(markdown-url-face ((,class (:inherit link))))

   ;; Magit
   `(magit-branch-local ((,class (:foreground ,camm4-brblue :weight bold))))
   `(magit-branch-remote ((,class (:foreground ,camm4-cyan :weight bold))))
   `(magit-tag ((,class (:foreground ,camm4-bryellow :weight bold))))
   `(magit-hash ((,class (:foreground ,camm4-white))))
   `(magit-diff-added ((,class (:foreground ,camm4-brgreen))))
   `(magit-diff-removed ((,class (:foreground ,camm4-brred))))
   `(magit-diff-context ((,class (:foreground ,camm4-white))))
   `(magit-section-heading ((,class (:foreground ,camm4-blue :weight bold :background ,camm4-brblack))))
   `(magit-section-highlight ((,class (:background ,camm4-brblack))))

   ;; Tree‑sitter (if you use it)
   `(tree-sitter-hl-face:function.call ((,class (:foreground ,camm4-brmagenta))))
   `(tree-sitter-hl-face:function.builtin ((,class (:foreground ,camm4-cyan))))
   `(tree-sitter-hl-face:variable.builtin ((,class (:foreground ,camm4-magenta))))
   `(tree-sitter-hl-face:type ((,class (:foreground ,camm4-brcyan))))
   `(tree-sitter-hl-face:constant.builtin ((,class (:foreground ,camm4-brblue))))

   ;; LSP / Flycheck
   `(flycheck-error ((,class (:underline (:style wave :color ,camm4-brred)))))
   `(flycheck-warning ((,class (:underline (:style wave :color ,camm4-bryellow)))))
   `(flycheck-info ((,class (:underline (:style wave :color ,camm4-brblue)))))
   `(lsp-face-highlight-textual ((,class (:background ,camm4-brblack :underline t))))

   ;; Extra
   `(show-paren-match ((,class (:background ,camm4-brcyan :foreground ,camm4-bg :weight bold))))
   `(show-paren-mismatch ((,class (:background ,camm4-brred :foreground ,camm4-bg :weight bold))))
   `(match ((,class (:background ,camm4-yellow :foreground ,camm4-fg))))
   `(shadow ((,class (:foreground ,camm4-white))))
   `(secondary-selection ((,class (:background ,camm4-brblack))))
   `(trailing-whitespace ((,class (:background ,camm4-brred))))
   `(vertical-border ((,class (:foreground ,camm4-white))))
   `(widget-button ((,class (:foreground ,camm4-blue :weight bold))))
   `(widget-field ((,class (:background ,camm4-brblack))))
   ))

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

(provide-theme 'camm4)

;;; camm4-theme.el ends here
