LoginSignup
22
20

More than 5 years have passed since last update.

CentOS環境にSolarizedカラースキームを適用する

Last updated at Posted at 2014-07-12
  • 自分しか使わない検証環境なのでrootユーザで実施してます。だれかから叱られそうだな。
  • 本来なら一般ユーザで実施すべきで必要なときだけsudosuすべきです。

シェル画面を目に優しくしたい

モチベーション

  • コードとか見る認知負荷を下げたい
  • 目にも優しい色合いにしたい

Solarizedを使うことにした

Solarized

  • 「dark」と「light」の2種類
  • どんなものかは本家サイトSolarizedを見てね
  • 説明文を以下引用しとく

Solarized is a sixteen color palette (eight monotones, eight accent colors) designed for use with terminal and gui applications. It has several unique properties. I designed this colorscheme with both precise CIELAB lightness relationships and a refined set of hues based on fixed color wheel relationships. It has been tested extensively in real world use on color calibrated displays (as well as uncalibrated/intentionally miscalibrated displays) and in a variety of lighting conditions.

VimにSolarized

必要なファイルのダウンロード

設定する

  • 作業ディレクトリ(/var/tmp)に格納する
# cd /var/tmp/
# unzip vim-colors-solarized-master.zip
# ls -l
drwxr-xr-x   6 root root  4096  5月 10 06:39 2011 vim-colors-solarized-master
-rw-r--r--   1 root root 24903  4月 19 04:54 2014 vim-colors-solarized-master.zip 
  • Vimカラースキームファイル格納ディレクトリ(~/.vim/colors/)を作成する
# mkdir -p ~/.vim/colors
# cp -p vim-colors-solarized-master/colors/solarized.vim ~/.vim/colors/
# ls -l ~/.vim/colors/
-rw-r--r-- 1 root root 51917  5月 10 06:39 2011 solarized.vim
  • Vim設定ファイル(~/.vimrc)に以下を追記する
~/.vimrc
syntax enable
set background=dark
colorscheme solarized

適用されているか確認する

  • 適当なperlファイルを開いてシンタックスカラーが適用されていることを確認
# vim /usr/lib64/perl5/Config_heavy.pl

LS_COLORSにSolarized

必要なファイルのダウンロード

設定する

  • 作業ディレクトリ(/var/tmp)への格納と設定ファイルの作成
# cd /var/tmp/
# unzip dircolors-solarized-master.zip
# ls -l
drwxr-xr-x  3 root root   4096  3月 26 03:03 2014 dircolors-solarized-master
-rw-r--r--  1 root root 555004  4月 19 22:05 2014 dircolors-solarized-master.zip
  • dircolors.256darkのシンボリックリンクとして.dircolorsを作成して、これを読み込むようにする
# mv /var/tmp/dircolors-solarized-master ~/dircolors-solarized
# ln -s ~/dircolors-solarized/dircolors.256dark ~/.dircolors
  • デフォルトで「dircolors-solarized」が適用されるように~/.bashrcに追記する
    • ちなみにviを実行したときにvimが実行されるようにエイリアスを追記してる
~/.bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Added vi alias vim
alias vi='vim'

# Customize LS_COLORS
LS_COLORS='no=00;38;5;244:rs=0:di=00;38;5;33:ln=00;38;5;37:mh=00:pi=48;5;230;38;5;136;01:so=48;5;230;38;5;136;01:do=48;5;230;38;5;136;01:bd=48;5;230;38;5;244;01:cd=48;5;230;38;5;244;01:or=48;5;235;38;5;160:su=48;5;160;38;5;230:sg=48;5;136;38;5;230:ca=30;41:tw=48;5;64;38;5;230:ow=48;5;235;38;5;33:st=48;5;33;38;5;230:ex=00;38;5;64:*.tar=00;38;5;61:*.tgz=00;38;5;61:*.arj=00;38;5;61:*.taz=00;38;5;61:*.lzh=00;38;5;61:*.lzma=00;38;5;61:*.tlz=00;38;5;61:*.txz=00;38;5;61:*.zip=00;38;5;61:*.z=00;38;5;61:*.Z=00;38;5;61:*.dz=00;38;5;61:*.gz=00;38;5;61:*.lz=00;38;5;61:*.xz=00;38;5;61:*.bz2=00;38;5;61:*.bz=00;38;5;61:*.tbz=00;38;5;61:*.tbz2=00;38;5;61:*.tz=00;38;5;61:*.deb=00;38;5;61:*.rpm=00;38;5;61:*.jar=00;38;5;61:*.rar=00;38;5;61:*.ace=00;38;5;61:*.zoo=00;38;5;61:*.cpio=00;38;5;61:*.7z=00;38;5;61:*.rz=00;38;5;61:*.apk=00;38;5;61:*.gem=00;38;5;61:*.jpg=00;38;5;136:*.JPG=00;38;5;136:*.jpeg=00;38;5;136:*.gif=00;38;5;136:*.bmp=00;38;5;136:*.pbm=00;38;5;136:*.pgm=00;38;5;136:*.ppm=00;38;5;136:*.tga=00;38;5;136:*.xbm=00;38;5;136:*.xpm=00;38;5;136:*.tif=00;38;5;136:*.tiff=00;38;5;136:*.png=00;38;5;136:*.svg=00;38;5;136:*.svgz=00;38;5;136:*.mng=00;38;5;136:*.pcx=00;38;5;136:*.dl=00;38;5;136:*.xcf=00;38;5;136:*.xwd=00;38;5;136:*.yuv=00;38;5;136:*.cgm=00;38;5;136:*.emf=00;38;5;136:*.eps=00;38;5;136:*.CR2=00;38;5;136:*.ico=00;38;5;136:*.tex=00;38;5;245:*.rdf=00;38;5;245:*.owl=00;38;5;245:*.n3=00;38;5;245:*.ttl=00;38;5;245:*.nt=00;38;5;245:*.torrent=00;38;5;245:*.xml=00;38;5;245:*Makefile=00;38;5;245:*Rakefile=00;38;5;245:*build.xml=00;38;5;245:*rc=00;38;5;245:*1=00;38;5;245:*.nfo=00;38;5;245:*README=00;38;5;245:*README.txt=00;38;5;245:*readme.txt=00;38;5;245:*.md=00;38;5;245:*README.markdown=00;38;5;245:*.ini=00;38;5;245:*.yml=00;38;5;245:*.cfg=00;38;5;245:*.conf=00;38;5;245:*.c=00;38;5;245:*.cpp=00;38;5;245:*.cc=00;38;5;245:*.log=00;38;5;240:*.bak=00;38;5;240:*.aux=00;38;5;240:*.lof=00;38;5;240:*.lol=00;38;5;240:*.lot=00;38;5;240:*.out=00;38;5;240:*.toc=00;38;5;240:*.bbl=00;38;5;240:*.blg=00;38;5;240:*~=00;38;5;240:*#=00;38;5;240:*.part=00;38;5;240:*.incomplete=00;38;5;240:*.swp=00;38;5;240:*.tmp=00;38;5;240:*.temp=00;38;5;240:*.o=00;38;5;240:*.pyc=00;38;5;240:*.class=00;38;5;240:*.cache=00;38;5;240:*.aac=00;38;5;166:*.au=00;38;5;166:*.flac=00;38;5;166:*.mid=00;38;5;166:*.midi=00;38;5;166:*.mka=00;38;5;166:*.mp3=00;38;5;166:*.mpc=00;38;5;166:*.ogg=00;38;5;166:*.ra=00;38;5;166:*.wav=00;38;5;166:*.m4a=00;38;5;166:*.axa=00;38;5;166:*.oga=00;38;5;166:*.spx=00;38;5;166:*.xspf=00;38;5;166:*.mov=00;38;5;166:*.mpg=00;38;5;166:*.mpeg=00;38;5;166:*.m2v=00;38;5;166:*.mkv=00;38;5;166:*.ogm=00;38;5;166:*.mp4=00;38;5;166:*.m4v=00;38;5;166:*.mp4v=00;38;5;166:*.vob=00;38;5;166:*.qt=00;38;5;166:*.nuv=00;38;5;166:*.wmv=00;38;5;166:*.asf=00;38;5;166:*.rm=00;38;5;166:*.rmvb=00;38;5;166:*.flc=00;38;5;166:*.avi=00;38;5;166:*.fli=00;38;5;166:*.flv=00;38;5;166:*.gl=00;38;5;166:*.m2ts=00;38;5;166:*.divx=00;38;5;166:*.webm=00;38;5;166:*.axv=00;38;5;166:*.anx=00;38;5;166:*.ogv=00;38;5;166:*.ogx=00;38;5;166:'
export LS_COLORS

if [ -f ~/.dircolors ]; then
    if type dircolors > /dev/null 2>&1; then
        eval $(dircolors ~/.dircolors)
    elif type gdircolors > /dev/null 2>&1; then
        eval $(gdircolors ~/.dircolors)
    fi
fi

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

適用されているか確認する

  • あとはシェルにログインしなおして、lsを実行すれば適用されていることが確認できる

22
20
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
22
20