LoginSignup
9

More than 3 years have passed since last update.

emacs-doom-themesで簡単オレオレthemeの作り方✨

Posted at

この記事はEmacs Advent Calendar 2019の6日目の記事です

こんにちは🤗
この記事ではemacsのカラーテーマをサクッと作るための方法について説明します

モチベーション

突然ですけどemacsのテーマって作るの大変じゃないですか?
emacsにはmajor-mode、minor-modeがたくさんありますよね。
たくさんのmodeに対応していくうちにああ俺何やってんだろ…という気持ちになってきてなんの成果も得られないのは嫌ですよね!

emacs-doom-themes

そんなあなたには簡単にオレオレテーマを作ることができる、
hlissner氏のemacs-doom-themesがオススメです。

emacs-doom-themesではベースの色を設定するだけで、
120以上のモード1に反映することができます。すごいですね。

このパッケージは現在31のテーマが用意されてるので作らず好きなの選んでもいいかもですね

また説明は割愛しますが、
seagle0128氏のdoom-modelineと併用するとemacsが途端にモダンなエディタへと早変わりします✨

インストール方法

下記を参照しましょう!
https://github.com/hlissner/emacs-doom-themes#manually

だいたい設定すればいい項目

だいたいinit.elに設定すればよい項目を下記に記載します
今回はAtomのカラーテーマelectron-highlighter-syntaxを参考に作りたいと思います。

init.el

;; 1. doom-themesをrequireする
(require 'doom-themes)

;; 2. def-doom-themeでオレオレthemeを定義する
(def-doom-theme my-electron-highlighter-syntax
  "My electron highlighter syntax theme."

  ;; 3. background, foreground, base0-8のthemeを定義
  ;; (名前      '("#RGB"   "256" "16" )) の並びになっています。
  ;; 256と16はソース読んでないのと試してないので設定する必要がわからないですが、
  ;; ターミナルから利用する場合などに利用されてるんじゃないでしょうか🤗
  ((bg         '("#202735" nil   nil ))
   (bg-alt     '("#191B20" nil   nil ))
   (base0      '("#141619" nil   nil ))
   (base1      '("#23262C" nil   nil ))
   (base2      '("#343840" nil   nil ))
   (base3      '("#444A55" nil   nil ))
   (base4      '("#555B6A" nil   nil ))
   (base5      '("#666D7E" nil   nil ))
   (base6      '("#767F93" nil   nil ))
   (base7      '("#8791A8" nil   nil ))
   (base8      '("#97A3BC" nil   nil ))
   (fg         '("#a8b5d1" nil   nil ))
   (fg-alt     '("#506686" nil   nil ))

   ;; 4. color themeを定義
   (grey       base4)
   (red        '("#ff5874" nil   nil ))
   (orange     '("#ffbf7a" nil   nil ))
   (green      '("#6af699" nil   nil ))
   (teal       '("#4db5bd" nil   nil ))
   (yellow     '("#fffa9e" nil   nil ))
   (blue       '("#82aaff" nil   nil ))
   (dark-blue  '("#2257A0" nil   nil ))
   (magenta    '("#c678dd" nil   nil ))
   (violet     '("#c792ea" nil   nil ))
   (cyan       '("#4ff2f8" nil   nil ))
   (dark-cyan  '("#5699AF" nil   nil ))

   ;; 5. face categoriesを定義
   ;; 各モードで利用するカラーを設定してあげます
   ;; なんとなくまあ名前から察せるのかと
   (highlight      blue)
   (vertical-bar   (doom-darken base1 0.2))
   (selection      dark-blue)
   (builtin        magenta)
   (comments       base7)
   (doc-comments   (doom-lighten dark-cyan 0.25))
   (constants      violet)
   (functions      magenta)
   (keywords       blue)
   (methods        cyan)
   (operators      blue)
   (type           yellow)
   (strings        cyan)
   (variables      fg)
   (numbers        orange)
   (region         `(,(doom-blend (car bg) (car magenta) 0.8) ,@(doom-lighten (cdr base1) 0.35)))
   (error          red)
   (warning        yellow)
   (success        green)
   (vc-modified    orange)
   (vc-added       green)
   (vc-deleted     red)

   ;; 6. (任意)custom categoriesを定義
   ;; 他doomでdefualtで設定している部分を設定してあげたい場合はここで
   (modeline-fg     nil))

  ;; 7. (任意)個別で設定したいmodeのfaceを定義
   ;; 各modeで個別に設定したい場合はこちらで設定!
  ((css-proprietary-property :foreground orange)
   (css-property             :foreground green)
   (css-selector             :foreground blue))
  )

↓こんな感じになりました。なかなか良い感じですね!

スクリーンショット 2019-12-06 22.04.13.png

まとめ

いかがでしたでしょうか!
簡単でしたが、そんなあなたには簡単にオレオレテーマを作ることができる、
emacs-doom-themesを紹介しました。

それでは!


  1. agda2-mode all-the-icons all-the-icons-dired anzu auctex (latex-mode) avy bookmark+ calfw centaur-tabs circe company company-box compilation cperl custom diff-hl diff-mode dired dired+ dired-k dired-subtree diredfl doom-modeline ediff elfeed elixir-mode elscreen enh-ruby-mode erc eshell evil evil-googles evil-mc evil-snipe flx-ido flycheck flycheck-posframe flymake flyspell git-commit git-gutter git-gutter+ git-gutter-fringe gnus helm helpful vhi-lock hideshow highlight-indentation-mode highlight-numbers-mode highlight-quoted-mode hl-line hl-todo hlinum hydra ido iedit imenu-list indent-guide isearch ivy ivy-posframe jabber jdee-mode js2-mode ledger-mode linum linum-relative lsp lui magit man-mode markdown-mode message mic-paren multiple cursors nav-flash neotree nlinum nlinum-hl nlinum-relative notmuch objed org-agenda org-habit org-mode outline parenface parinfer persp-mode perspective pkgbuild-mode popup power rainbow-delimiters re-builder rpm-spec-mode rst-mode sh-mode show-paren smartparens smerge-tool solaire-mode spaceline stripe-buffer swiper tabbar telephone-line term tldr treemacs twittering-mode typescript-mode undo-tree vimish-fold volatile-highlights vterm web-mode wgrep which-func which-key whitespace widget window-divider woman workgroups2 yasnippet makefile-*-mode 

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
9