unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Rotating color themes?
@ 2008-04-07  1:56 Alan
  2008-04-07  4:56 ` Drew Adams
  0 siblings, 1 reply; 2+ messages in thread
From: Alan @ 2008-04-07  1:56 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: Rotating color themes?
  2008-04-07  1:56 Rotating color themes? Alan
@ 2008-04-07  4:56 ` Drew Adams
  0 siblings, 0 replies; 2+ messages in thread
From: Drew Adams @ 2008-04-07  4:56 UTC (permalink / raw)
  To: 'Alan', help-gnu-emacs

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

See the code in these functions for implementation ideas:

http://www.emacswiki.org/cgi-bin/wiki/oneonone.el: functions
`1on1-color-minibuffer-frame-on-setup', `1on1-color-minibuffer-frame-on-exit'
(but changes frame background hue, not theme)

http://www.emacswiki.org/cgi-bin/wiki/doremi-cmd.el: function
`doremi-color-themes' cycles among color themes, applying next to all frames (vs
what you want, which is give the next frame created the next color theme)

The latter uses the following list of color themes. You might use something
similar, and just advance a pointer into the list.

(defcustom doremi-color-themes
  (and (require 'color-theme nil t)
       (delq 'bury-buffer (mapcar 'car color-themes)))
  "*List of color themes to cycle through using `doremi-color-themes'."
  :type 'hook :group 'doremi-misc-commands)

Shouldn't be hard to do what you want. But I can't imagine that color themes
would be a great way to give frames recognizable identity.

HTH.








^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-07  4:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-07  1:56 Rotating color themes? Alan
2008-04-07  4:56 ` Drew Adams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).