(defvarxah-cycle-colors [ "cornsilk""seashell""honeydew"] "A vector of color names (string) for `xah-cycle-background-color'. URL `http://xahlee.info/emacs/emacs/emacs_toggle_background_color.html' ")
(defunxah-cycle-background-color ()
"Cycle background color among values in variable `xah-cycle-colors'.
Return the new color name.
URL `http://xahlee.info/emacs/emacs/emacs_toggle_background_color.html'
Created: 2010-03-20
Version: 2025-11-23"
(interactive)
(let* ((xstate-old
(if (get 'xah-cycle-background-color 'xstate)
(get 'xah-cycle-background-color 'xstate)
(1- (lengthxah-cycle-colors))))
(xstate-new (% (1+ xstate-old) (lengthxah-cycle-colors)))
(xcolor (arefxah-cycle-colorsxstate-new)))
(put 'xah-cycle-background-color 'xstatexstate-new)
(set-background-color xcolor)
(message"background color changed to %s"xcolor)
xcolor))