Emacs: Turning Day into night

| | Comments () | TrackBacks (0)

I have gained an interest in cyberpunk novels again and have been looking at the Shadowrun RPG. One of the hallmarks of cyberpunk is a dark, depressing atmosphere. This darkness is also associated with the coolness that is running the shadows or jacking into the Matrix or whatever. But, I believe, there is a benefit to a dark-themed desktop: it hurts the eyes less after hours of staring at a light-themed desktop.

In any case, I spend most of my time in Emacs so I needed a way to change the colour of the background and the text easily.

Code

Below is some Emacs Lisp code that lets you switch between light-green text on a black background and black text on a white background. When the F12 key is pressed it will switch between the two modes.

(defvar *color-mode* 'light
  "Color mode for ``switch-colors''. Can be 'light or 'dark.")
(defun switch-colors ()
  "Switches between light and dark color modes. Useful if your
eyes are weary."
  (interactive)
  (case *color-mode*
    ('light (set-background-color "black")
	    (set-foreground-color "lightgreen")
	    (setq *color-mode* 'dark))
    ('dark (set-background-color "white")
	   (set-foreground-color "black")
	   (setq *color-mode* 'light))))

(global-set-key [f12] 'switch-colors)

What can I say, I like feeling cool while coding :P

Screenshots

Day

Night

0 TrackBacks

Listed below are links to blogs that reference this entry: Emacs: Turning Day into night.

TrackBack URL for this entry: http://www.neverfriday.com/cgi-bin/mt/mt-tb.cgi/6

Comments