Skip to content

Commit

Permalink
💄 support cursor color for different mode
Browse files Browse the repository at this point in the history
  • Loading branch information
shitianshu committed Jun 21, 2020
1 parent 04314e0 commit ae8e55e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 5 deletions.
41 changes: 41 additions & 0 deletions meow-face.el
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,46 @@
"Motion indicator"
:group 'meow)

(defface meow-normal-cursor
'((((class color) (background dark))
(:background "#FC4"))
(((class color) (background light))
(:background "#FC4")))
"Normal state cursor."
:group 'meow)

(defface meow-insert-cursor
'((((class color) (background dark))
(:background "#3C6"))
(((class color) (background light))
(:background "#3C6")))
"Insert state cursor."
:group 'meow)

(defface meow-motion-cursor
'((((class color) (background dark))
(:background "#39F"))
(((class color) (background light))
(:background "#39F")))
"Motion state cursor."
:group 'meow)

(defface meow-keypad-cursor
'((((class color) (background dark))
(:background "#E68"))
(((class color) (background light))
(:background "#E68")))
"Keypad state cursor."
:group 'meow)

(defface meow-unknown-cursor
'((((class color) (background dark))
(:background "white"))
(((class color) (background light))
(:background "black")))
"Unknown state cursor."
:group 'meow)


(provide 'meow-face)
;;; meow-face.el ends here
15 changes: 10 additions & 5 deletions meow-util.el
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,20 @@
"Update cursor type according to current state."
(cond
((meow-insert-mode-p)
(setq cursor-type '(bar . 2)))
(setq cursor-type '(bar . 4))
(set-cursor-color (face-attribute 'meow-insert-cursor :background)))
((meow-normal-mode-p)
(setq cursor-type 'box))
(setq cursor-type 'box)
(set-cursor-color (face-attribute 'meow-normal-cursor :background)))
((meow-motion-mode-p)
(setq cursor-type 'box))
(setq cursor-type 'box)
(set-cursor-color (face-attribute 'meow-motion-cursor :background)))
((meow-keypad-mode-p)
(setq cursor-type 'hollow))
(setq cursor-type 'box)
(set-cursor-color (face-attribute 'meow-keypad-cursor :background)))
(t
(setq cursor-type 'box))))
(setq cursor-type 'box)
(set-cursor-color (face-attribute 'meow-unknown-cursor :background)))))

(defun meow--switch-state (state)
"Switch to STATE."
Expand Down

0 comments on commit ae8e55e

Please sign in to comment.