Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
emacs-version: ['27.1', '28.2', '29.4', '30.1', 'snapshot']
emacs-version: ['28.2', '29.4', '30.1', 'snapshot']
steps:
- uses: actions/checkout@v4
- uses: purcell/setup-emacs@master
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
strategy:
fail-fast: false
matrix:
emacs-version: ['27.2', '28.2', '29.4', '30.1', 'snapshot']
emacs-version: ['28.2', '29.4', '30.1', 'snapshot']
steps:
- uses: actions/checkout@v4
- uses: purcell/setup-emacs@master
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## master (unreleased)

### Changes

- Dynamically calculate line drawing color (`s-line`) from palette base tones instead of hardcoded hex values.
- Bump minimum required Emacs version to 28.1 (for `color-values-from-color-spec`).

### New features

- Add the `solarized-everforest-dark` and `solarized-everforest-light`, `solarized-flexoki-dark` and `solarized-flexoki-light`, and `solarized-kanagawa-wave`, `solarized-kanagawa-dragon` and `solarized-kanagawa-lotus` variants.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Here are the two canonical variants:
You can find some more screenshots of Solarized for Emacs
[here](https://emacsthemes.com/themes/solarized-themes.html).

Solarized for Emacs supports officially Emacs 24+. The theme is implemented
Solarized for Emacs officially requires Emacs 28.1+. The theme is implemented
in terms of customisations and `deftheme` and does not require the
`color-theme-package`.

Expand Down
51 changes: 24 additions & 27 deletions solarized-faces.el
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@
:box (:line-width 1 :color ,s-mode-line-inactive-bg
:style nil)))))
`(region
((,class (,@(and (>= emacs-major-version 27) '(:extend t))
((,class (:extend t
:foreground ,base03
:background ,base1))))
`(secondary-selection
((,class (,@(and (>= emacs-major-version 27) '(:extend t))
((,class (:extend t
:background ,base02))))
`(shadow ((,class (:foreground ,base01))))
`(success ((,class (:foreground ,green ))))
Expand Down Expand Up @@ -1144,10 +1144,10 @@
`(highlight-symbol-face ((,class (:foreground ,magenta))))
;;;;; hl-line-mode
`(hl-line
((,class (,@(and (>= emacs-major-version 27) '(:extend t))
((,class (:extend t
:background ,base02))))
`(hl-line-face
((,class (,@(and (>= emacs-major-version 27) '(:extend t))
((,class (:extend t
:background ,base02))))
;;;;; hl-todo
`(hl-todo ((,class (:foreground ,orange :weight bold))))
Expand Down Expand Up @@ -1327,63 +1327,63 @@
;;;;; magit
;;;;;; headings and diffs
`(magit-section-highlight
((t (,@(and (>= emacs-major-version 27) '(:extend t))
((t (:extend t
:background ,base02))))
`(magit-section-heading ((t (:foreground ,yellow :weight bold))))
`(magit-section-heading-selection ((t (:foreground ,orange :weight bold))))
`(magit-diff-file-heading ((t (:weight bold))))
`(magit-diff-file-heading-highlight
((t (,@(and (>= emacs-major-version 27) '(:extend t))
((t (:extend t
:background ,base02))))
`(magit-diff-file-heading-selection
((t (,@(and (>= emacs-major-version 27) '(:extend t))
((t (:extend t
:background ,base02
:foreground ,orange))))
`(magit-diff-hunk-heading
((t (,@(and (>= emacs-major-version 27) '(:extend t))
((t (:extend t
:background ,yellow-1bg
:foreground ,yellow-1fg))))
`(magit-diff-hunk-heading-highlight
((t (,@(and (>= emacs-major-version 27) '(:extend t))
((t (:extend t
:background ,yellow-2bg
:foreground ,yellow-2fg))))
`(magit-diff-hunk-heading-selection
((t (,@(and (>= emacs-major-version 27) '(:extend t))
((t (:extend t
:background ,(solarized-color-blend yellow base02 0.1)
:foreground ,orange
:weight bold))))
`(magit-diff-lines-heading
((t (,@(and (>= emacs-major-version 27) '(:extend t))
((t (:extend t
:background ,orange
:foreground ,base3))))
`(magit-diff-context-highlight
((t (,@(and (>= emacs-major-version 27) '(:extend t))
((t (:extend t
:background ,base02
:foreground ,base1))))
`(magit-diff-added
((,class (,@(and (>= emacs-major-version 27) '(:extend t))
((,class (:extend t
:background ,green-1bg
:foreground ,green-1fg))))
`(magit-diff-added-highlight
((,class (,@(and (>= emacs-major-version 27) '(:extend t))
((,class (:extend t
:background ,green-1bg
:foreground ,green-1fg))))
`(magit-diff-base
((,class (,@(and (>= emacs-major-version 27) '(:extend t))
((,class (:extend t
:background ,yellow-1bg
:foreground ,yellow-1fg))))
`(magit-diff-base-highlight
((,class (,@(and (>= emacs-major-version 27) '(:extend t))
((,class (:extend t
:background ,yellow-1bg
:foreground ,yellow-1fg))))
`(magit-diff-conflict-heading ((,class (:inherit magit-diff-hunk-heading))))
`(magit-diff-context ((,class (:foreground ,base0))))
`(magit-diff-removed
((,class (,@(and (>= emacs-major-version 27) '(:extend t))
((,class (:extend t
:background ,red-1bg
:foreground ,red-1fg))))
`(magit-diff-removed-highlight
((,class (,@(and (>= emacs-major-version 27) '(:extend t))
((,class (:extend t
:background ,red-1bg
:foreground ,red-1fg))))
`(magit-diffstat-added ((t (:foreground ,s-diffstat-added-fg))))
Expand All @@ -1409,10 +1409,10 @@
`(magit-bisect-bad ((t (:foreground ,red))))
;;;;;; blame
`(magit-blame-highlight
((t (,@(and (>= emacs-major-version 27) '(:extend t))
((t (:extend t
:background ,base02))))
`(magit-blame-heading
((t (,@(and (>= emacs-major-version 27) '(:extend t))
((t (:extend t
:background ,base02
:box (:color ,base02 :line-width 2)))))
`(magit-blame-summary ((t (:foreground ,base0))))
Expand Down Expand Up @@ -1606,7 +1606,7 @@
`(mu4e-view-url-number-face ((,class (:foreground ,yellow :weight normal))))
`(mu4e-warning-face ((,class (:foreground ,red :slant normal :weight bold))))
`(mu4e-header-highlight-face
((,class (,@(and (>= emacs-major-version 27) '(:extend t))
((,class (:extend t
:inherit unspecified
:foreground unspecified :background ,base02
:underline unspecified :weight unspecified))))
Expand Down Expand Up @@ -1808,11 +1808,11 @@
`(outline-8 ((,class (:inherit ,s-variable-pitch :foreground ,blue))))
;;;;; outline-minor-faces
`(outline-minor-0
((,class (,@(and (>= emacs-major-version 27) '(:extend t))
((,class (:extend t
:weight bold
:background ,base02))))
`(outline-minor-1
((,class (,@(and (>= emacs-major-version 27) '(:extend t))
((,class (:extend t
:inherit (outline-minor-0 outline-1)
:background ,(solarized-color-blend base03 yellow .9)))))
;;;;; paren-face
Expand Down Expand Up @@ -2160,7 +2160,7 @@
((t (:underline nil :background ,(solarized-color-blend yellow-l s-base3 0.2)))))
`(transient-mismatched-key
((t (:underline nil :background ,(solarized-color-blend red-l s-base3 0.2)))))
`(transient-separator ((t (,@(and (>= emacs-major-version 27) '(:extend t))
`(transient-separator ((t (:extend t
:background ,s-line))))
;;;;; tuareg
`(tuareg-font-lock-governing-face ((,class (:foreground ,magenta :weight bold))))
Expand Down Expand Up @@ -2434,9 +2434,6 @@
`(pos-tip-background-color ,base02)
;;;;; smartrep
`(smartrep-mode-line-active-bg (solarized-color-blend ,green ,s-mode-line-bg 0.2))
;;;;; term
`(term-default-fg-color ,base0) ;; @deprecated24.3
`(term-default-bg-color ,base03) ;; @deprecated24.3
;;;;; vc
`(vc-annotate-background-mode nil)
`(vc-annotate-color-map
Expand Down
4 changes: 2 additions & 2 deletions solarized-theme.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
;; Author: Thomas Frössman <thomasf@jossystem.se>
;; URL: http://github.com/bbatsov/solarized-emacs
;; Version: 2.2.0
;; Package-Requires: ((emacs "24.1"))
;; Package-Requires: ((emacs "28.1"))
;; Keywords: convenience, themes, solarized

;; This program is free software; you can redistribute it and/or modify
Expand All @@ -32,7 +32,7 @@
;; the two themes in a folder that is on `custom-theme-load-path'
;; and enjoy!
;;
;; Don't forget that the theme requires Emacs 24.
;; Don't forget that the theme requires Emacs 28.1.
;;
;;; Credits
;;
Expand Down
24 changes: 19 additions & 5 deletions solarized.el
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,18 @@ Optional argument ROUND rounds values which probably is what you usually want."
(format fmt (+ 0.5 (* red maxval)) (+ 0.5 (* green maxval)) (+ 0.5 (* blue maxval)))
(format fmt (* red maxval) (* green maxval) (* blue maxval)))))

(defun solarized-color-name-to-rgb (color)
"Return the RGB components of COLOR as numbers between 0.0 and 1.0.
COLOR is a hex spec or a color name. Signal an error if it is neither."
(let ((values (and (stringp color)
(or (color-values-from-color-spec color)
(tty-color-standard-values
(downcase (string-replace " " "" color)))))))
(cond
(values (mapcar (lambda (v) (/ v 65535.0)) values))
((and (stringp color) (color-name-to-rgb color)))
(t (error "Solarized: %S is not a color" color)))))

;;;###autoload
(defun solarized-color-blend (color1 color2 alpha &optional digits-per-component)
"Blends COLOR1 onto COLOR2 with ALPHA.
Expand All @@ -161,8 +173,8 @@ use the latter if you need a 24-bit specification of a color."
(solarized-color-clamp-lab
(cl-mapcar
(lambda (v1 v2) (+ v1 (* alpha (- v2 v1))))
(apply 'color-srgb-to-lab (color-name-to-rgb color2))
(apply 'color-srgb-to-lab (color-name-to-rgb color1))))))))
(apply 'color-srgb-to-lab (solarized-color-name-to-rgb color2))
(apply 'color-srgb-to-lab (solarized-color-name-to-rgb color1))))))))
(apply 'solarized-color-rgb-to-hex `(,@args ,digits-per-component t))))

;;;###autoload
Expand Down Expand Up @@ -292,8 +304,10 @@ customize the resulting theme."
;; Line drawing color
;;
;; NOTE only use this for very thin lines that are hard to see using base02, in low
;; color displays base02 might be used instead
(s-line (if (eq variant 'light) "#cccec4" "#284b54"))
;; color displays base02 might be used instead. A palette can set it
;; with an `s-line' entry; otherwise it is blended from base01 and base02.
(s-line (or ,(alist-get 's-line color-palette*)
(solarized-color-blend base01 base02 0.35 2)))

;; Light/Dark adaptive higher/lower contrast accented colors
;;
Expand Down Expand Up @@ -543,7 +557,7 @@ Useful after changing some configuration options or tweaking some colors."
;;; Footer

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

Expand Down
53 changes: 53 additions & 0 deletions test/solarized-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,59 @@ others use.")
(dolist (pair (symbol-value (cdr entry)))
(expect (solarized-test--hex-p (cdr pair)) :to-be-truthy)))))

;;; Color conversion
;;
;; The suite runs in batch, where `color-name-to-rgb' rounds to the few
;; colors a terminal frame has (#284b54 comes back as pure blue).

(describe "color conversion"
(it "reads hex colors and color names whatever the frame"
(expect (solarized-color-name-to-rgb "#284b54")
:to-equal (list (/ #x2828 65535.0) (/ #x4b4b 65535.0) (/ #x5454 65535.0)))
(expect (solarized-color-name-to-rgb "gray20") :to-equal '(0.2 0.2 0.2))
(expect (solarized-color-name-to-rgb "Light Slate Gray")
:to-equal (solarized-color-name-to-rgb "lightslategray")))

(it "signals an error for something that is not a color"
(expect (solarized-color-name-to-rgb "#28b54") :to-throw 'error)))

;;; Line color

(defun solarized-test--forget-theme (theme)
"Remove every trace of THEME, a theme the test defined itself."
(when (custom-theme-enabled-p theme)
(disable-theme theme))
(mapatoms (lambda (sym)
(when (get sym 'theme-face)
(put sym 'theme-face (assq-delete-all theme (get sym 'theme-face))))))
(put theme 'theme-settings nil)
(setq custom-known-themes (delq theme custom-known-themes)))

(describe "line color (s-line)"
(after-each
(dolist (v solarized-test--variants)
(when (custom-theme-enabled-p v)
(disable-theme v))))

(it "follows the palette rather than staying Solarized cyan"
(let-alist solarized-gruvbox-dark-color-palette-alist
(solarized-test--reload 'solarized-gruvbox-dark)
(expect (solarized-test--face-attr 'vertical-border 'solarized-gruvbox-dark :foreground)
:to-equal (solarized-color-blend .base01 .base02 0.35 2))))

(it "uses the palette's own s-line entry when it has one"
(unwind-protect
(progn
(eval `(progn
(deftheme solarized-test-s-line)
(solarized-with-color-variables 'dark 'solarized-test-s-line
',(cons '(s-line . "#123456") solarized-dark-color-palette-alist)))
t)
(enable-theme 'solarized-test-s-line)
(expect (solarized-test--face-attr 'vertical-border 'solarized-test-s-line :foreground)
:to-equal "#123456"))
(solarized-test--forget-theme 'solarized-test-s-line))))

;;; Syntax highlighting has to be readable on the background
;;
;; This is the contrast that matters most and is measured least: whether the
Expand Down
Loading