手軽にfontの色とか変えてみたい

faceの設定をいじれば良さそう。
kordersでfaces.elの中を覗いてみた
大体、分かったと想う。

  • describe-faceでどの様なattributeで設定されているか確認する。
  • face-listで現在使用しているfaceがlistになって帰ってくる
  • face-attributeで指定したfaceのattributeを取り出せる
  • set-face*という感じの名前の関数でattributeを設定できる。

あと、色とかfaceの情報を見るにはlist-*-displayという感じの関数が便利

  • list-faces-display
  • list-colors-display

とか

(setq faces (face-list))
(defun filterd-face (attr expect)
  (let ((Expect (capitalize expect)))
    (reduce (lambda (it face)
	      (let ((target (face-attribute face attr)))
	      (if (or (string= target expect)
		      (string= target Expect))
		(cons face it)
	      it)))
	  (face-list) :initial-value nil)))

(filterd-face :foreground "gold");; => (font-lock-comment-face font-lock-function-name-face font-lock-variable-name-face message-header-newsgroups-face message-header-name-face gnus-summary-high-unread-face gnus-header-subject-face gnus-header-newsgroups-face gnus-emphasis-highlight-words gnus-cite-face-1 diary-face quack-pltish-defn-face)

(defun search-all-faces-color ()
  (reduce (lambda (it face)
	    (let ((c (face-attribute face :foreground )))
	      (if (member c it)  it (cons c it))))
	  (face-list) :initial-value nil))

(defun face-edit-by-color (src dest)
  (dolist (f (filterd-face :foreground src))
    (set-face-foreground f dest)))

(search-all-faces-color); => (grey70 grey80 grey90 Khaki LightSteelBlue Pink brown4 sky blue Yellow lightGray Aquamarine green PaleGreen red SkyBlue light yellow MediumAquamarine PaleTurquoise aquamarine4 Wheat Cyan aquamarine2 Magenta light gray magenta pale green khaki light pink wheat turquoise coral beige Gray50 orange azure3 Black gray30 hot pink cyan1 Orange Green1 LightSteelBlue1 green2 LightSkyBlue2 gold purple1 cyan2 #00f000 salmon blue1 white black violet lime green gray80 unspecified pink light blue)

(face-edit-by-color "gold" "MintCream")
(face-edit-by-color "cyan" "yellow1")
(face-edit-by-color "yellow1" "pink")
(face-edit-by-color "MintCream" "gold")

明日にフォントの色とか決める。j