CSSでrgba()を使うようになったので、#RRGGBBで書いていた色もrgb()で書き直すことにした。手作業でやるのはとても面倒なので、Vimスクリプトの勉強がてら#RRGGBBからrgb(r, g, b)に変換する関数を作って変換した。 function! HexToFunc(hex) let color = matchlist(a:hex, '\([0-9A-F]\{2\}\)\([0-9A-F]\{2\}\)\([0-9A-F]\{2\}\)') return 'rgb(' . printf('%d', '0x' . color[1]) . ', ' . printf('%d', '0x' . color[2]) . ', ' . printf('%d', '0x' . color[3]) . ')' endfunction matchlist()で2桁ずつ区切ってやり、それぞれ
![Vimで#RRGGBBからrgb(r,g,b)に変換](https://cdn-ak-scissors.b.st-hatena.com/image/square/f2fda417d491d805f79065104db5f50e11015215/height=288;version=1;width=512/https%3A%2F%2Fhail2u.net%2Fapple-touch-icon-precomposed.png)