help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Rotating color themes?


From: Alan
Subject: Rotating color themes?
Date: Sun, 6 Apr 2008 18:56:50 -0700 (PDT)
User-agent: G2/1.0

Some years back (Aug. 5, 2002), I received a response to a query about
changing background color for new frames.  Kai Grossjohann sent a
snippet that I have been using, possibly with little tweaks, ever
since.  It is helpful to have different frames easily identifiable.

I have recently discovered "color-themes".  This approach solves the
problem of faces that are not clearly visible on a given background.
I am now asking whether anyone can suggest how to code a similar
routine to cycle the color-themes in new frames.

 Here is the  code that works pretty well (with the forewarning that I
don't understand 1/2 of how it works):

-------beginning of code-----------
(setq initial-frame-alist
      '((width . 80)
        (height . 43)
        (foreground-color . "green1")
        (background-color . "black")
        (tool-bar-lines . 1)
        (menu-bar-lines . 1)
        (cursor-color . "yellow")
        (mouse-color . "orange")
        (left . 200)
        (top . 25)
        (user-position . t)
        )
      )


;;;;;; Default frame parameter values, for all frames
(setq default-frame-alist
      '((width . 80)
        (height . 43)
        (foreground-color . "yellow")
        (background-color . "DeepSkyBlue4")
        (tool-bar-lines . 1)
        (menu-bar-lines . 1)
        (cursor-color . "red")
        (mouse-color . "cyan")
        (left . 250)
        (top . 34)
        (user-position . t)
        )
      )

;;;;;; Cycling frame colors
;;;;;; Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann)
;;;;;; Newsgroups: gnu.emacs.help, 5 Aug 2002
(defun my-next-bg-color (frame)
  (let ((x (assq 'background-color default-frame-alist)))
    (setq default-frame-alist (delq x default-frame-alist))
    (add-to-list 'default-frame-alist
                 (cons 'background-color
                       (cond ((equal (cdr x) "DeepSkyBlue4")
                              "dark olive green")
                             ((equal (cdr x) "dark olive green")
                              "black")
                             ((equal (cdr x) "black")
                              "dark blue")
                             ((equal (cdr x) "dark blue")
                              "saddle brown")
                             ((equal (cdr x) "saddle brown")
                              "blue1")
                             ((equal (cdr x) "blue1")
                              "maroon")
                             ((equal (cdr x) "maroon")
                              "blue violet")
                             ((equal (cdr x) "blue violet")
                              "MediumPurple")
                             ((equal (cdr x) "MediumPurple")
                              "RoyalBlue3")
                             ((equal (cdr x) "RoyalBlue3")
                              "cyan4")
                             ((equal (cdr x) "cyan4")
                              "DeepSkyBlue4")
                             (t "black"))))))
(add-hook 'after-make-frame-functions 'my-next-bg-color)
-------end of code---------

I might mention that I never have gotten this to work seamlessly: it
does, however, work sufficiently well for my simple purposes.

Thank you,

Alan Davis


reply via email to

[Prev in Thread] Current Thread [Next in Thread]