Skip to content

Instantly share code, notes, and snippets.

@unthingable unthingable/init.el
Last active Dec 31, 2015

What would you like to do?
color-theme sensitive hl-line
;; (set-face-background hl-line-face "medium purple")
;; fix hl-line color dynamically:
(require 'hexrgb)
(defun my-fix-hl-line-color ()
"Adjust hl-line color relative to current color theme"
((color (face-attribute 'default :background))
(value (hexrgb-value color))
(threshold 0.32)
(scale 0.9)
(separation 0.06)
(+ threshold
(* scale
(+ (- value threshold)
(if (< value threshold) 0.15 (- 0.0)))))))
(hexrgb-increment-value color (- new-value value)))
(message "%S %S" value new-value)))
(add-hook 'after-init-hook 'my-fix-hl-line-color)
(if (package-installed-p 'color-theme)
(defadvice color-theme-install-at-point (after fix-hl-line activate)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.