Skip to content

Commit

Permalink
Revert "[spacemacs-bootstrap] Fix mode-line evil state foreground"
Browse files Browse the repository at this point in the history
This reverts commit 4562da2.

Revert reason:
emacsclient broken on develop branch by commit 4562da2
syl20bnr#13766
  • Loading branch information
duianto committed Jul 13, 2020
1 parent c43b9ea commit 1e677bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 34 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.develop
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,6 @@ Other:
- Fixed ~SPC h f~ =helm-spacemacs-help-faq= (thanks to duianto)
- Fixed =cl= package deprecated =letf= (thanks to duianto)
- Fixed origami bindings in normal mode (thanks to Tomasz Kowal)
- Fixed mode-line evil state foreground color (thanks to duianto)
*** Layer changes and fixes
**** Agda
- Fixes
Expand Down
37 changes: 4 additions & 33 deletions layers/+distributions/spacemacs-bootstrap/funcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -58,46 +58,17 @@ For evil states that also need an entry to `spacemacs-evil-cursors' use
;; visibly flashing in treemacs buffers
(eval `(defface ,(intern (format "spacemacs-%s-face" state))
`((t (:background ,color
:foreground ,(spacemacs/get-darker-color-of-face-fg-or-bg
'mode-line)
:foreground ,(face-background 'mode-line)
:inherit 'mode-line)))
(format "%s state face." state)
:group 'spacemacs)))

(defun spacemacs/set-state-faces ()
(cl-loop for (state color cursor) in spacemacs-evil-cursors
do
(set-face-attribute
(intern (format "spacemacs-%s-face" state))
nil
:foreground (spacemacs/get-darker-color-of-face-fg-or-bg 'mode-line))))

(defun spacemacs/get-darker-color-of-face-fg-or-bg (face)
"Return the darker color of the FACE foreground or background,
based on the luminance of the FACE background.
If the FACE background is brighter than 0.5,
return the FACE background,
otherwise return the FACE foreground."
(if (> 0.5 (rainbow-x-color-luminance (face-background face)))
(face-background face)
(face-foreground face)))

;; source: http://elpa.gnu.org/packages/rainbow-mode-1.0.4.el
(defun rainbow-color-luminance (red green blue)
"Calculate the relative luminance of color composed of RED, GREEN and BLUE.
Return a value between 0 and 1."
(/ (+ (* .2126 red) (* .7152 green) (* .0722 blue)) 255))

;; source: http://elpa.gnu.org/packages/rainbow-mode-1.0.4.el
(defun rainbow-x-color-luminance (color)
"Calculate the relative luminance of a color string (e.g. \"#ffaa00\", \"blue\").
Return a value between 0 and 1."
(let* ((values (x-color-values color))
(r (/ (car values) 256.0))
(g (/ (cadr values) 256.0))
(b (/ (caddr values) 256.0)))
(rainbow-color-luminance r g b)))
(set-face-attribute (intern (format "spacemacs-%s-face" state))
nil
:foreground (face-background 'mode-line))))

(defun evil-insert-state-cursor-hide ()
(setq evil-insert-state-cursor '((hbar . 0))))
Expand Down

0 comments on commit 1e677bb

Please sign in to comment.