all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Customizing faces...which method?
@ 2002-10-03 16:53 Moore, Mathew L
  0 siblings, 0 replies; 4+ messages in thread
From: Moore, Mathew L @ 2002-10-03 16:53 UTC (permalink / raw)


Hello Emacsperts,

What is the "proper" way for customizing font-lock face attributes in the
initialization file?  There seems to be a bunch of ways to do it.

I would like to set different foregrounds (colors) depending on whether the
foreground is light or dark.  When I use the customize tool, it seems to
ignore the value of frame-background-mode and sets the selected face
attributes for all background states.

So I've gone to hand editing the code right below the "do not edit or
cut/paste" section that customize writes to my init file.

Is there a better way to do this?  Every time I read the documentation on
faces, my head spins a little.

Thanks for your help,
--Matt

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

* Re: Customizing faces...which method?
       [not found] <mailman.1033666437.5547.help-gnu-emacs@gnu.org>
@ 2002-10-03 18:44 ` Peter Boettcher
  2002-10-03 19:42 ` Ivan Kanis
  2002-10-03 20:28 ` Alan Shutko
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Boettcher @ 2002-10-03 18:44 UTC (permalink / raw)


"Moore, Mathew L" <MooreML@BATTELLE.ORG> writes:

> What is the "proper" way for customizing font-lock face attributes in the
> initialization file?  There seems to be a bunch of ways to do it.
>
> I would like to set different foregrounds (colors) depending on whether the
> foreground is light or dark.  When I use the customize tool, it seems to
> ignore the value of frame-background-mode and sets the selected face
> attributes for all background states.
>
> So I've gone to hand editing the code right below the "do not edit or
> cut/paste" section that customize writes to my init file.
>
> Is there a better way to do this?  Every time I read the documentation on
> faces, my head spins a little.

I do face setting by hand, outside the customize section:

      (set-face-foreground 'font-lock-function-name-face "firebrick")
      (set-face-foreground 'font-lock-comment-face "red")
      (make-face-bold 'font-lock-comment-face)
      (set-face-foreground 'font-lock-string-face "mediumseagreen")
      (set-face-foreground 'font-lock-variable-name-face "darkgoldenrod")


-- 
Peter Boettcher
MIT Lincoln Laboratory
boettcher@ll.mit.edu

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

* Re: Customizing faces...which method?
       [not found] <mailman.1033666437.5547.help-gnu-emacs@gnu.org>
  2002-10-03 18:44 ` Peter Boettcher
@ 2002-10-03 19:42 ` Ivan Kanis
  2002-10-03 20:28 ` Alan Shutko
  2 siblings, 0 replies; 4+ messages in thread
From: Ivan Kanis @ 2002-10-03 19:42 UTC (permalink / raw)



    Matt> I would like to set different foregrounds (colors) depending
    Matt> on whether the foreground is light or dark.  When I use the
    Matt> customize tool, it seems to ignore the value of
    Matt> frame-background-mode and sets the selected face attributes
    Matt> for all background states.

I am editing my own code in .emacs. I have done this in many different
ways. Using inheritance seem to be the most flexible. As you see the
colors are defined for a light and dark background. The color switch
automatically when I change the background color. I have two functions
called 'light' and 'dark' that toggles the background. I have also
aliased the function 'custom-set-face' to 'my-set-face'. This prevents
the customize tool from screwing up my settings.

Hope this helps!

Ivan

; define an alias to custom-set-face to keep customise messing with my
; font definition
(defalias 'my-set-faces 'custom-set-faces)

; two color combinations for sunny and rainy days
(defun dark()
(interactive)
(my-set-faces
 '(default ((t (:foreground "white" :background "black"))) t)
))

(defun light()
(interactive)
(my-set-faces
 '(default ((t (:foreground "black" :background "grey82"))) t)
))

; Faces customizations
(defface blue-face
  '((((class color) (background light))
       (:foreground "blue"))
      (((class color) (background dark))
       (:foreground "cyan"))
      )
  "Basic face for blue text"
  :version "21.1"
  :group 'basic-faces)

(defface red-face
  '((((class color) (background light))
       (:foreground "red"))
      (((class color) (background dark))
       (:foreground "yellow"))
      )
  "Basic face for red text"
  :version "21.1"
  :group 'basic-faces)

(defface normal-face
  '((((class color) (background light))
       (:foreground "red"))
      (((class color) (background dark))
       (:foreground "yellow"))
      )
  "Basic face for normal text"
  :version "21.1"
  :group 'basic-faces)

(defface purple-face
  '((((class color) (background light))
       (:foreground "purple"))
      (((class color) (background dark))
       (:foreground "magenta"))
      )
  "Basic face for purple text"
  :version "21.1"
  :group 'basic-faces)

(defface green-face
  '((((class color) (background light))
       (:foreground "dark green"))
      (((class color) (background dark))
       (:foreground "green"))
      )
  "Basic face for purple text"
  :version "21.1"
  :group 'basic-faces)


; Faces that uses inheritance
(my-set-faces
 '(bold ((t (:inherit red-face))))
 '(bold-italic ((t (:inherit blue-face))))
 '(comint-input-face ((t (:inherit blue-face))))
 '(cperl-array-face ((t (:inherit normal-face))))
 '(cperl-hash-face ((t (:inherit normal-face))))
 '(cperl-nonoverridable-face ((t (:inherit purple-face))))
 '(cvs-filename-face ((t (:inherit blue-face))))
 '(cvs-handled-face ((t (:inherit green-face))))
 '(cvs-header-face ((t (:inherit blue-face))))
 '(eshell-ls-archive-face ((t (:inherit blue-face))))
 '(eshell-ls-backup-face ((t (:inherit normal-face))))
 '(eshell-ls-clutter-face ((t (:inherit normal-face))))
 '(eshell-ls-directory-face ((t (:inherit red-face))))
 '(eshell-ls-executable-face ((t (:inherit green-face))))
 '(eshell-ls-missing-face ((t (:inherit normal-face))))
 '(eshell-ls-product-face ((t (:inherit normal-face))))
 '(eshell-ls-readonly-face ((t (:inherit normal-face))))
 '(eshell-ls-special-face ((t (:inherit normal-face))))
 '(eshell-ls-symlink-face ((t (:inherit purple-face))))
 '(eshell-ls-unreadable-face ((t (:inherit normal-face))))
 '(eshell-prompt-face ((t (:inherit normal-face))))
 '(font-lock-comment-face ((t (:inherit green-face))))
 '(font-lock-doc-face ((t (:inherit green-face))))
 '(font-lock-doc-string-face ((t (:inherit green-face))))
 '(font-lock-function-name-face ((t (:inherit blue-face))))
 '(font-lock-keyword-face ((t (:inherit purple-face))))
 '(font-lock-other-type-face ((t (:inherit purple-face))))
 '(font-lock-preprocessor-face ((t (:inherit purple-face))))
 '(font-lock-reference-face ((t (:inherit red-face))))
 '(font-lock-string-face ((t (:inherit green-face))))
 '(font-lock-type-face ((t (:inherit purple-face))))
 '(font-lock-variable-name-face ((t (:inherit blue-face))))
 '(font-lock-warning-face ((t (:inherit purple-face))))
 '(info-node ((t (:inherit blue-face))))
 '(info-xref ((t (:inherit blue-face))))
 '(italic ((t (:inherit normal-face))))
 '(woman-bold-face ((t (:inherit red-face))))
 '(woman-italic-face ((t (:inherit normal-face))))
 '(message-cited-text ((t (:inherit green-face))))
)

; Special faces
(my-set-faces
 '(cursor ((((background dark)) (:background "yellow")) 
    (((background light)) (:background "red"))))
 '(default ((t (:foreground "white" :background "black"))))
 '(highlight 
   ((((background light)) (:background "black" :foreground "darkseagreen2"))
	(((background dark)) (:background "darkseagreen2" :foreground "black"))))
 '(isearch 
   ((((background light)) (:background "paleturquoise" :foreground "black"))
	(((background dark)) (:background "yellow" :foreground "black"))))
 '(show-paren-match-face ((((class color)) 
    (:background "green" :foreground "black"))))
 '(show-paren-mismatch-face ((((class color)) (:background "red"))))
)



-- 
/-----------------------------------------------------------------------------*
|  "I can stand brute force, but brute reason is quite   |     Ivan Kanis     |
|  unbearable. There is something unfair about its use.  |  ivank@juliva.com  |
|  It is hitting below the intellect."                   |   www.juliva.com   |
|  (Oscar Wilde)                                         |                    |
*-----------------------------------------------------------------------------/

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

* Re: Customizing faces...which method?
       [not found] <mailman.1033666437.5547.help-gnu-emacs@gnu.org>
  2002-10-03 18:44 ` Peter Boettcher
  2002-10-03 19:42 ` Ivan Kanis
@ 2002-10-03 20:28 ` Alan Shutko
  2 siblings, 0 replies; 4+ messages in thread
From: Alan Shutko @ 2002-10-03 20:28 UTC (permalink / raw)


"Moore, Mathew L" <MooreML@BATTELLE.ORG> writes:

> I would like to set different foregrounds (colors) depending on whether the
> foreground is light or dark.  When I use the customize tool, it seems to
> ignore the value of frame-background-mode and sets the selected face
> attributes for all background states.

Set custom-face-default-form to all.

-- 
Alan Shutko <ats@acm.org> - In a variety of flavors!
Trial Law: Tess Temoni

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

end of thread, other threads:[~2002-10-03 20:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-03 16:53 Customizing faces...which method? Moore, Mathew L
     [not found] <mailman.1033666437.5547.help-gnu-emacs@gnu.org>
2002-10-03 18:44 ` Peter Boettcher
2002-10-03 19:42 ` Ivan Kanis
2002-10-03 20:28 ` Alan Shutko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.