12
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Emacs] ãƒĄã‚ŋãƒģã‚Ģナãƒŧ゚キãƒŧムとしãĻぎ solarized

12
Last updated at Posted at 2015-02-05

Emacs ぎã‚Ģナãƒŧ゚キãƒŧムをč‡Ē力で変更しようとすると、あらゆる face ãŽč‰˛ã‚’ä¸€ã¤ä¸€ã¤č¨­åŽšã—ãĻいくことãĢãĒãŖãĻ、éĸ倒です。

「厌成したはいいけおãĒんか違和感â€Ļ」とãĒることもしばしばâ€Ļâ€Ļ。

ã“ãŽč¨˜äē‹ã§ã¯č‡Ē分がかつãĻäŊŋãŖãĻã„ãŸã€į°Ąå˜ãĢそこそこぞともãĒã‚Ģナãƒŧ゚キãƒŧãƒ ã‚’į”Ÿæˆã™ã‚‹æ–šæŗ•ã‚’į´šäģ‹ã—ぞす。


有名ãĒã‚Ģナãƒŧ゚キãƒŧムãĢ、 solarized というぎがありぞす。

solari.png

solarized ãŽã‚ŗãƒŧドは、ぞずäŊŋã†č‰˛ãŽä¸€čĻ§ã‚’åŽšįžŠã—ã€ããŽä¸€čĻ§ã‚’ã‚‚ã¨ãĢ各々ぎ face ãŽč‰˛ã‚’č¨­åŽšã™ã‚‹ã‚ˆã†ãĢåŽŸčŖ…ã•ã‚ŒãĻいぞす。

ã“ã‚Œã‚’åˆŠį”¨ã—ãĻ、「äŊŋã†č‰˛ãŽä¸€čĻ§ã€ã‚’ã‚ã‚‰ã‹ã˜ã‚č‡Ē分がäŊŋã„ãŸã„č‰˛ã§ä¸Šæ›¸ãã—ãĻおき、あとは solarized ãĢč‰¯ã„æ„Ÿã˜ãĢé…č‰˛ã—ãĻã‚‚ã‚‰ã†ã€ã¨ã„ã†æ–šæŗ•ã§ã‚Ģナãƒŧ゚キãƒŧãƒ ã‚’į”Ÿæˆã™ã‚‹ãŽãŒæŦĄãŽãƒžã‚¯ãƒ­ã§ã™ã€‚

(require 'color)
(require 'solarized-definitions)

(defun my-mix-colors (color1 color2 percent)
  (cl-destructuring-bind ((r g b) rr gg bb)
      (cons (color-name-to-rgb color1) (color-name-to-rgb color2))
    (let* ((x (/ percent 100.0)) (y (- 1 x)))
      (color-rgb-to-hex (+ (* r y) (* rr x)) (+ (* g y) (* gg x)) (+ (* b y) (* bb x))))))

(defmacro create-solarized-based-theme
  (name mode darkest-base brightest-base yellow orange red magenta violet blue cyan green)
  (declare (indent 2))
  (let* ((solarized-colors
          `((base03  ,darkest-base)
            (base02  ,(my-mix-colors darkest-base brightest-base 3))
            (base01  ,(my-mix-colors darkest-base brightest-base 35))
            (base00  ,(my-mix-colors darkest-base brightest-base 40))
            (base0   ,(my-mix-colors darkest-base brightest-base 52))
            (base1   ,(my-mix-colors darkest-base brightest-base 58))
            (base2   ,(my-mix-colors darkest-base brightest-base 95))
            (base3   ,brightest-base)
            (yellow ,yellow) (orange ,orange) (red ,red) (magenta ,magenta)
            (violet ,violet) (blue ,blue) (cyan ,cyan) (green ,green)))
         (defs (solarized-color-definitions mode))
         (theme-vars (mapcar (lambda (def) (list (car def) (cdr def))) (second defs)))
         (theme-faces (first defs)))
    `(progn
       (deftheme ,name)
       (apply 'custom-theme-set-variables ',name ',theme-vars)
       (apply 'custom-theme-set-faces ',name ',theme-faces)
       (provide-theme ',name))))

こぎマクロをäŊŋうと、たとえばæŦĄãŽã‚ˆã†ãĢį°Ąå˜ãĢã‚Ģナãƒŧ゚キãƒŧãƒ ã‚’į”Ÿæˆã™ã‚‹ã“ã¨ãŒã§ããžã™ã€‚

(create-solarized-based-theme
 solarized-jellybeans ;; テãƒŧマぎ名前
 dark                 ;; dark ぞたは light
 "#202020"            ;; 一į•Ēæš—ã„č‰˛
 "#ffffff"            ;; 一į•Ēæ˜Žã‚‹ã„色
 ;; ãƒã‚¤ãƒŠã‚¤ãƒˆč‰˛Ã—īŧ˜
 "#ffb964" "#8fbfdc" "#a04040" "#b05080" "#805090" "#fad08a" "#99ad6a" "#8fbfdc")

これは vim ぎ jellybeans をベãƒŧ゚ãĢã—ãŸé…č‰˛ã§ã™ã€‚ã“ã‚“ãĒ感じãĢãĒりぞす。

jelly.png

ãƒĸãƒŧドãĢ light を指厚すればį™ŊčƒŒæ™¯ãĢãĒりぞす。

(create-solarized-based-theme solarized-mesa light
      "#000000" "#faf5ee" "#3388dd" "#ac3d1a" "#dd2222"
      "#8b008b" "#00b7f0" "#1388a2" "#104e8b" "#00688b")

これは emacs ぎ mesa をベãƒŧ゚ãĢã—ãŸé…č‰˛ã§ã™ã€‚

mesa.png

お手čģŊãĢæ°—åˆ†ã‚’å¤‰ãˆã‚‰ã‚Œã‚‹ãŽã§ã€ã‚ˆã‹ãŖãŸã‚‰čŠĻしãĻãŋãĻください。

12
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?