Add fill-column-indicator and move non-face colours to theme files

This commit is contained in:
Wojciech Kozlowski 2017-08-27 23:09:18 +01:00
parent e49ab3f57f
commit de1f2cdab4
3 changed files with 51 additions and 18 deletions

27
init.el
View File

@ -59,12 +59,6 @@
;; Load the dark theme by default.
(load-theme 'havoc-dark t) ;; Load personal theme
;; Setup key-bindings for switching between themes.
(global-set-key (kbd "C-x t l") '(lambda () (interactive)
(load-theme 'havoc-light t)))
(global-set-key (kbd "C-x t d") '(lambda () (interactive)
(load-theme 'havoc-dark t)))
;; --------------------------------------------------------------------------
;; Change file in which custom variable changes are saved.
;; --------------------------------------------------------------------------
@ -151,6 +145,19 @@
(interactive)
(let (kill-buffer-query-functions) (kill-buffer)))
(defun refresh-non-face-colours ()
"Restart modes that use colours not set with face variables.
This has to be called whenever the active theme changes to
refresh these colours."
(when (and (fboundp 'fci-mode)
(fci-mode))
(fci-mode 1))
(when (and (fboundp 'highlight-parentheses-mode)
(highlight-parentheses-mode))
(highlight-parentheses-mode 1)))
;; --------------------------------------------------------------------------
;; Convenience keyboard shortcuts.
;; --------------------------------------------------------------------------
@ -164,6 +171,14 @@
;; Change active window. More convenient than "C-x o".
(global-set-key (kbd "M-o") 'other-window)
;; Setup key-bindings for switching between themes.
(global-set-key (kbd "C-x t l") '(lambda () (interactive)
(load-theme 'havoc-light t)
(refresh-non-face-colours)))
(global-set-key (kbd "C-x t d") '(lambda () (interactive)
(load-theme 'havoc-dark t)
(refresh-non-face-colours)))
;; --------------------------------------------------------------------------
;; Aliases.
;; --------------------------------------------------------------------------

View File

@ -23,7 +23,8 @@
whole-line-or-region
duplicate-thing
volatile-highlights
expand-region)
expand-region
fill-column-indicator)
)
@ -46,6 +47,14 @@
:defer t
:bind (("C-'" . er/expand-region)))
;; --------------------------------------------------------------------------
;; Column indicator.
;; --------------------------------------------------------------------------
(use-package fill-column-indicator
:defer t
:init (add-hook 'prog-mode-hook 'fci-mode))
;; --------------------------------------------------------------------------
;; Volatile highlights - highlight changes caused by undo, yank, etc.
;; --------------------------------------------------------------------------
@ -65,12 +74,7 @@
:defer t
:init
(add-hook 'prog-mode-hook 'show-paren-mode)
(add-hook 'prog-mode-hook 'highlight-parentheses-mode)
:config
(setq hl-paren-colors '("#86DC2F"
"IndianRed1"
"IndianRed3"
"IndianRed4")))
(add-hook 'prog-mode-hook 'highlight-parentheses-mode))
;; --------------------------------------------------------------------------
;; Use UTF-8.

View File

@ -87,6 +87,11 @@
(*rdd-8* (if (eq variant 'dark) "#89E14B" "#00BB00"))
(*rdd-9* (if (eq variant 'dark) "#40E0D0" "#00BBBB"))
;; Highlight parentheses colours
(*hlp-1* (if (eq variant 'dark) "#FF6A6A" "#FF6A6A"))
(*hlp-2* (if (eq variant 'dark) "#EE6363" "#EE6363"))
(*hlp-3* (if (eq variant 'dark) "#CD5555" "#CD5555"))
;; Diff colors
(*diff-added-bg* (if (eq variant 'dark) "#336622" "#DDFFDD"))
(*diff-added-fg* (if (eq variant 'dark) "#DDFFDD" "#22AA22"))
@ -213,14 +218,14 @@
`(rainbow-delimiters-depth-8-face ((t (:foreground ,*rdd-8*))))
`(rainbow-delimiters-depth-9-face ((t (:foreground ,*rdd-9*))))
;;;;; diff
;; diff
`(diff-header ((t (:background ,*header-bg*))))
`(diff-file-header ((t (:foreground ,*diff-file-hdr-fg*))))
`(diff-hunk-header ((t (:background ,*diff-hunk-hdr-bg* :foreground ,*diff-hunk-hdr-fg*))))
`(diff-added ((t (:background ,*diff-added-bg* :foreground ,*diff-added-fg*))))
`(diff-removed ((t (:background ,*diff-rmvd-bg* :foreground ,*diff-rmvd-fg*))))
;;;;; magit
;; magit
`(magit-blame-culprit ((t :background ,*active-line* :foreground ,*fg-standout*)))
`(magit-blame-date ((t :background ,*active-line* :foreground ,*string*)))
`(magit-blame-hash ((t :background ,*active-line* :foreground ,*method-declaration*)))
@ -276,7 +281,7 @@
`(magit-section-highlight ((t (:background ,*bg-2*))))
`(magit-section-title ((t (:background ,*bg-1* :foreground ,*keywords* :inherit bold))))
;;;;; helm
;; helm
`(helm-bookmark-directory ((t (:inherit helm-ff-directory))))
`(helm-bookmark-file ((t (:foreground ,*base*))))
`(helm-bookmark-gnus ((t (:foreground ,*comp*))))
@ -316,12 +321,21 @@
`(helm-time-zone-home ((t (:foreground ,*comp* :background ,*bg-1*))))
`(helm-visible-mark ((t (:foreground ,*keywords* :background ,*bg-3*))))
;;;;; helm-swoop
;; helm-swoop
`(helm-swoop-target-line-block-face ((t (:foreground ,*base* :background ,*current-line*))))
`(helm-swoop-target-line-face ((t (:background ,*current-line*))))
`(helm-swoop-target-word-face ((t (:background ,*current-line* :foreground ,*mat*))))
)))
)
;; Define values for colours that don't use faces.
(setq fci-rule-color *bg-3*)
(setq hl-paren-colors '(*success*
*hlp-1*
*hlp-2*
*hlp-3*))
))
;;;###autoload
(when (and (boundp 'custom-theme-load-path) load-file-name)