🔔说明:在修改或添加样式的时候,一定要单独定义css文件,并将其放置于根目录中,不要与主题文件的样式代码混写,否则,一段时间后,主题一旦需要更新,自定义的样式就会被新主题样式覆盖。
图标修改
添加css样式文件
在根目录的 source
文件夹下新新建一个 css
文件夹,并新建一个title.css
文件
添加在根目录下的css
文件,最终会生成到可执行文件中,即使更新主题的时候,也不会有影响😉
添加对css样式的引用
在_config.butterfly.yaml
的inject
节点下,添加引用
1 2 3
| inject: head: - <link rel="stylesheet" href="/css/title.css">
|
更换风车图标
原始的butterfly
主题的标题样式,是曲别针样式
在_config.butterfly.yaml
中修改beautify
节点
代码如下:
1 2 3 4 5
| beautify: enable: true field: post title-prefix-icon: '\f863' title-prefix-icon-color: '#F47466'
|
风车旋转
风车样式 css
将下面的代码添加到title.css
文件中
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| h1::before, h2::before, h3::before, h4::before, h5::before, h6::before { -webkit-animation: ccc 1.6s linear infinite ; animation: ccc 1.6s linear infinite ; } @-webkit-keyframes ccc { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg) } to { -webkit-transform: rotate(-1turn); transform: rotate(-1turn) } } @keyframes ccc { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg) } to { -webkit-transform: rotate(-1turn); transform: rotate(-1turn) } }
|
配置H1~H6标题的颜色
同样添加到title.css
中
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| #content-inner.layout h1::before { color: #ef50a8 ; margin-left: -1.55rem; font-size: 1.3rem; margin-top: -0.23rem; } #content-inner.layout h2::before { color: #fb7061 ; margin-left: -1.35rem; font-size: 1.1rem; margin-top: -0.12rem; } #content-inner.layout h3::before { color: #ffbf00 ; margin-left: -1.22rem; font-size: 0.95rem; margin-top: -0.09rem; } #content-inner.layout h4::before { color: #a9e000 ; margin-left: -1.05rem; font-size: 0.8rem; margin-top: -0.09rem; } #content-inner.layout h5::before { color: #57c850 ; margin-left: -0.9rem; font-size: 0.7rem; margin-top: 0.0rem; } #content-inner.layout h6::before { color: #5ec1e0 ; margin-left: -0.9rem; font-size: 0.66rem; margin-top: 0.0rem; }
|
修改当鼠标经过风车时的样式
同样添加到title.css
中
1 2 3 4 5 6 7 8 9
| #content-inner.layout h1:hover, #content-inner.layout h2:hover, #content-inner.layout h3:hover, #content-inner.layout h4:hover, #content-inner.layout h5:hover, #content-inner.layout h6:hover { color: #49b1f5 ; } #content-inner.layout h1:hover::before, #content-inner.layout h2:hover::before, #content-inner.layout h3:hover::before, #content-inner.layout h4:hover::before, #content-inner.layout h5:hover::before, #content-inner.layout h6:hover::before { color: #49b1f5 ; -webkit-animation: ccc 3.2s linear infinite ; animation: ccc 3.2s linear infinite ; }
|
备注:图标来源
网站 fontawesome,复制 Unicode
参考文章:我的Blog美化日记——Hexo+Butterfly | Guo Le’s Blog