Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change the cursor color on emacs

I made some changes in Emacs's colors and the only thing wrong now is the cursor that is black on black background and I will have to change that. What do I do?

like image 333
fakedrake Avatar asked Jan 10 '11 00:01

fakedrake


People also ask

How do I change my cursor color in Ubuntu?

After installing GNOME Tweaks, navigate to the top-left 'Activities' overview. Go to GNOME Tweaks and open it. Once you open GNOME Tweaks, go to the Appearance option from the left pane. Choose a different cursor theme from the drop-down menu.

How do I change cursor color in Netbeans?

Editor If you now go to tab "Code Templates" you can check in the code sample box and see that the cursor appears with the new color. The trick is to click Apply (doing and undoing any other change) from this tab so the cursor setting will make effect.


1 Answers

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'.

like image 110
Zarza Avatar answered Sep 28 '22 08:09

Zarza