From 0e23bee07b2e5b3f69fce8d6465d7179aada68d7 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Sun, 1 Jan 2023 22:28:33 +0100 Subject: Tentatively adapt to Modus 4 FTR, things that I expect to need further tweaks and/or discussions with Prot: (a) no "version" command, so it's kind of hard to guess what we are working with programmatically, (b) preset palettes overrides are unavailable before loading the themes, and we can't require 'modus-themes either; maybe the manual should point out that users who want to use those presets should (1) do that in :config (2) load the theme twice? (c) lots of backgrounds look very light/saturated to me even in the "faint preset": e.g. diff backgrounds, selected completion, region, eldoc current argument. --- .emacs | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 4 deletions(-) (limited to '.emacs') diff --git a/.emacs b/.emacs index b810d3c..d9b99ab 100644 --- a/.emacs +++ b/.emacs @@ -640,9 +640,7 @@ :custom (use-package-always-defer t)) -(use-package emacs - :when (>= emacs-major-version 28) - :init +(defun my/modus<4-config () (setq modus-themes-bold-constructs t modus-themes-deuteranopia t modus-themes-diffs 'bg-only @@ -657,9 +655,61 @@ modus-themes-prompts '(background) modus-themes-region '(bg-only) modus-themes-variable-pitch-ui t) - :config (load-theme 'modus-vivendi)) +(defun my/hsl-to-rgbhex (h s l) + (apply + 'color-rgb-to-hex + `(,@(color-hsl-to-rgb h s l) 2))) + +(defun my/decline-diff-hue (h) + (list-colors-display + (seq-map (lambda (l) (my/hsl-to-rgbhex h 1.0 l)) + '(0.04 0.08 0.16)))) + +(defun my/modus>=4-config () + (setq modus-themes-bold-constructs t + modus-themes-italic-constructs t + modus-themes-mixed-fonts t + modus-themes-variable-pitch-ui t + modus-themes-headings '((1 . (variable-pitch 1.2)) + (2 . (variable-pitch 1.15)) + (3 . (variable-pitch 1.1)) + (4 . (variable-pitch 1.05)) + (t . (variable-pitch))) + modus-themes-org-blocks 'gray-background) + (load-theme 'modus-vivendi-deuteranopia) + (setq modus-vivendi-deuteranopia-palette-overrides + ;; TODO: set bg-prompt? + `(;; (my/decline-diff-hue 0.14) + (bg-removed-faint "#141100") + (bg-removed "#282200") + (bg-removed-refine "#514400") + ;; (my/decline-diff-hue 0.59) + (bg-added-faint "#000914") + (bg-added "#001228") + (bg-added-refine "#002551") + ;; (my/decline-diff-hue 0.76) + (bg-changed-faint "#0b0014") + (bg-changed "#160028") + (bg-changed-refine "#2d0051") + ,@modus-themes-preset-overrides-faint)) + (load-theme 'modus-vivendi-deuteranopia)) + +(use-package emacs + :when (>= emacs-major-version 28) + ;; `(modus-themes) Sample configuration with and without + ;; use-package' recommends setting options in :init and loading the + ;; theme in :config; unfortunately it's not possible to access the + ;; palettes without loading the themes AFAICT, so do everything in + ;; :config. + :config + (cond + ((memq 'modus-vivendi-deuteranopia (custom-available-themes)) + (my/modus>=4-config)) + (t + (my/modus<4-config)))) + (use-package package :custom (package-selected-packages -- cgit v1.2.3