butterfly主题魔改08:侧边栏及其卡片美化、文章等页面渐变背景
参考文章: https://blog.liushen.fun/posts/28ae33b6/
01 侧边栏及其卡片美化
1、效果图

2、主题配置文件修改
博客根目录下_config.butterfly.yml
文件的侧边栏设置
的代码如下:
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
aside: enable: true hide: false button: true mobile: false position: left display: archive: true tag: true category: true card_author: enable: true description: button: enable: true icon: fab fa-github text: Follow Me link: https://kukual.github.io/ card_announcement: enable: true content: | <style> .announcement-card { --main-color: #ff00ff; --secondary-color: #00ffff; --highlight-color: #ff5500; position: relative; overflow: hidden; } .announcement-content { font-size: 1rem; line-height: 1.2; color: #ffffff; position: relative; } .keyword { color: var(--secondary-color); font-weight: 300; font-size: 1.1rem; } .highlight { color: var(--main-color); font-weight: 1000; font-size: 1.2rem; } .announcement-content ul { list-style-type: none; margin: 0.8rem 0; padding-left: 1.5rem; } </style> <div class="announcement-card"> <div class="announcement-content"> <p><span class="highlight">欢迎来到「酷库阿洛」网络安全研习录</span>!🎉</p> <p><strong>本平台专注于:</strong></p> <ul> <li><span class="keyword">> 网络安全技术研究</span></li> <li><span class="keyword">> 渗透测试实战案例</span></li> <li><span class="keyword">> CTF竞赛解析</span></li> <li><span class="keyword">> 漏洞复现分析</span></li> </ul> <p>🌟 <strong>加入我们,一起探索网络安全奥秘,提升攻防实战能力,共同守护数字世界的安宁!</strong></p> </div> </div> card_recent_post: enable: true limit: 3 sort: date sort_order: 4 card_newest_comments: enable: false sort_order: limit: 6 storage: 10 avatar: true card_categories: enable: true limit: 5 expand: none sort_order: 3 card_tags: enable: false limit: 40 color: false orderby: random order: 1 sort_order: card_archives: enable: false type: monthly format: MMMM YYYY order: -1 limit: 8 sort_order: card_post_series: enable: true series_title: true orderBy: 'date' order: -1 card_webinfo: enable: true post_count: true last_push_date: true sort_order: 5 runtime_date: 2025/03/26/ 12:00 AM
|
3、主题样式文件修改
在博客根目录下\themes\butterfly\source\css\custom.css
文件中添加如下代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| .card-widget { background: linear-gradient(-45deg, #e2c1ffee, #ffb6e6ee, #c9a9ffee, #ffb3fdee) !important; }
#aside-content > .card-widget.card-info > #card-info-btn { background-color: #7019c2f8; border-radius: 8px; }
@keyframes Gradient { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
[data-theme="dark"] .card-widget{ background: rgba(45, 10, 61, 0.7) !important; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important; }
|
02 主页文章、分类等页面设置渐变背景
1、效果图

2、样式代码
在博客根目录下\themes\butterfly\source\css\custom.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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
| /*导航栏*/ .nav-fixed>#nav { background: linear-gradient(-45deg, backdrop-filter: blur(10px); } [data-theme="dark"] .nav-fixed>#nav{ background: rgba(45, 10, 61, 0.7) !important; backdrop-filter: blur(10px); } /*文章页面*/ .layout>#post { background: linear-gradient(-45deg, }
[data-theme=dark] .layout>#post { background: rgba(45, 10, 61, 0.7) !important; }
/*主页文章轮播页面*/
background: linear-gradient(-45deg, } [data-theme=dark] background: rgba(45, 10, 61, 0.7) !important; }
/*主页文章列表页面卡片*/
background: linear-gradient(-45deg, } [data-theme=dark] background: rgba(45, 10, 61, 0.7) !important; } /*分类页面*/ .layout>#page { background: linear-gradient(-45deg, } [data-theme=dark] .layout>#page { background: rgba(45, 10, 61, 0.7) !important; }
/*归档页面*/ .layout>#archive { background: linear-gradient(-45deg, } [data-theme=dark] .layout>#archive { background: rgba(45, 10, 61, 0.7) !important; }
/*分类点进去的页面*/ .layout>#category { background: linear-gradient(-45deg, } [data-theme=dark] .layout>#category { background: rgba(45, 10, 61, 0.7) !important; }
/*标签点进去的页面*/ .layout>#tag { background: linear-gradient(-45deg, } [data-theme=dark] .layout>#tag { background: rgba(45, 10, 61, 0.7) !important; }
.layout.hide-aside { max-width: 1600px; } /* 设置黑夜的时候,社交按钮为白色 */ [data-theme=dark] .social-icon i { color: rgba(188, 188, 188) !important; /* 设置为白色 */ }
|