How to change the cursor color on emacs

If you are running a recent version of emacs you can use:

; Set cursor color to white
(set-cursor-color "#ffffff") 

Instead of #ffffff you can use any color you like. For a list of hex code google Says: http://www.tayloredmktg.com/rgb/


Maybe you like this one… the following code changes the cursor color on each blink. Just eval code and its running:

; Using in Emacs 24.0 

(defvar blink-cursor-colors (list  "#92c48f" "#6785c5" "#be369c" "#d9ca65")
  "On each blink the cursor will cycle to the next color in this list.")

(setq blink-cursor-count 0)
(defun blink-cursor-timer-function ()
  "Zarza wrote this cyberpunk variant of timer `blink-cursor-timer'. 
Warning: overwrites original version in `frame.el'.

This one changes the cursor color on each blink. Define colors in `blink-cursor-colors'."
  (when (not (internal-show-cursor-p))
    (when (>= blink-cursor-count (length blink-cursor-colors))
      (setq blink-cursor-count 0))
    (set-cursor-color (nth blink-cursor-count blink-cursor-colors))
    (setq blink-cursor-count (+ 1 blink-cursor-count))
    )
  (internal-show-cursor nil (not (internal-show-cursor-p)))
  )

Note that this code replaces the emacs function ‘blink-cursor-timer-function’ from ‘frame.el’.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)