avatar
文章
66
标签
24
分类
4
主页
博文
  • 分类
  • 标签
  • 归档
wiki
友链
世界
  • 开往
  • 虫洞
Diraw的世界
搜索
主页
博文
  • 分类
  • 标签
  • 归档
wiki
友链
世界
  • 开往
  • 虫洞

Diraw的世界

Butterfly魔改4:自动检测深色/浅色模式
发表于2025-01-04|计算机| 条评论
前言添加功能:根据系统的深色/浅色模式,自动切换网站的深色/浅色模式。 方法1在 \themes\butterfly\layout\includes\head.pug 的最后添加如下代码: script. function updateTheme() { const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches; document.documentElement.setAttribute('data-theme', isDarkMode ? 'dark' : 'light'); } // 初始设置 updateTheme(); // 监听系统主题变化 window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', updateTheme); 方法2(推荐)先跟着Butterfly魔改准备工作:文件管理魔改代码完成准备。 在 custom.js...
Butterfly魔改3:修改副标题字体大小
发表于2025-01-03|计算机| 条评论
前言众所周知,Butterfly在可以在 _config.yml 中用 font 配置全局的字体和代码大小,如下图所示: # Global font settings# Don't modify the following settings unless you know how they workfont: global_font_size: 16px code_font_size: 16px font_family: code_font_family:# Font settings for the site title and site subtitleblog_title_font: font_link: font_family: 但是一些更精细的调整就没有了。就比如我把全局大小设置成16px之后,我感觉我首页的副标题的中文字体有点大了,我想改小一点。 步骤在 \themes\butterfly\layout\includes\header\index.pug 中搜索 site-subtitle 可以找到: #site-subtitle ...
Butterfly魔改2:页面渐变切换
发表于2025-01-03|计算机| 条评论
准备工作这边使用Pjax来实现页面的动画。Butterfly内置了Pjax插件,直接在 /themes/butterfly/_config.yml 中搜索Pjax,然后把 enable 选项改成 true,如下所示: # https://github.com/MoOx/pjaxpjax: enable: true # Exclude the specified pages from pjax, such as '/music/' exclude: # - /xxxxxx/ 步骤首先,在 /themes/butterfly/source/css 下创建 custom.css 写入如下代码: /* 默认(白天模式) */body { background-color: white; color: black;}[data-theme="dark"] body { background-color: #121212; color: white;}.pjax-leave-active { opacity: 0; background-color:...
Butterfly魔改1:首页大图预加载
发表于2025-01-03|计算机| 条评论
前言众所周知,Butterfly的首页大图可以通过在 _config.yml 文件中中配置 index_img 选项来实现。 但是如果你用的是GitHub Pages来部署的,而你配置的首页大图的大小又有好几M,不算太小的话,有时候访问网站就会出现——先加载Butterfly框架出来,此时首页大图是蓝色的默认背景,然后才逐渐把你配置的大图加载出来——的这种情况。 我不喜欢这种情况,因为我希望别人一进网站就被我的首页大图震撼(bushi),如果图片是慢慢加载出来的话就没有那种震撼感了,甚至说体验感比较一般。所以我准备对Butterfly的源码魔改一波。 以下是Butterfly官方网站的加载情况,可以看到这个图片逐渐加载的现象: 方法1现在我们来魔改一下源代码,以实现图片预加载的功能。 打开 themes/butterfly/layout/includes/layout.pug 这个文件,在 body 的最前面添加如下代码: body(style="visibility: hidden; overflow: hidden;") ...
Hexo报错ssh: connect to host github.com port 22: Connection timed out解决办法
发表于2025-01-03|计算机| 条评论
hexo d 报错ssh: connect to host github.com port 22: Connection timed out ssh: connect to host github.com port 22: Connection timed outfatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists.FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.htmlError: Spawn failed at ChildProcess.<anonymous>...
Butterfly报错TypeError: coverVal.indexOf is not a function解决办法
发表于2025-01-02|计算机| 条评论
魔改了一下Butterfly的源代码之后 hexo g 出现如下报错: TypeError: coverVal.indexOf is not a function at Hexo.<anonymous> (E:\Blog\themes\butterfly\scripts\filters\random_cover.js:15:30) at Hexo.tryCatcher (E:\Blog\node_modules\bluebird\js\release\util.js:16:23) at Hexo.<anonymous> (E:\Blog\node_modules\bluebird\js\release\method.js:15:34) at E:\Blog\node_modules\hexo\dist\extend\filter.js:58:67 at tryCatcher (E:\Blog\node_modules\bluebird\js\release\util.js:16:23) at...
1…67
avatar
Diraw
希望能构建心中的一片圣地
文章
66
标签
24
分类
4
Follow Me
公告

所有知识整理类博文已全部移动至wiki文档

其他站点
资料分发
词源文档
文件分享
文本分享
云盘服务
短链生成
简单图床
LibreChat
最新文章
Python:全局解释器锁GIL2026-01-14
2026跨年:写给2027年1月1日的信2026-01-01
非独立联合概率分布和Copula理论2025-12-26
分类
  • 物理2
  • 生活4
  • 英语2
  • 计算机58
标签
英语2记录4物理2Hexo19linux8ubuntu9vscode3cuda1debian7windows9powershell1注册表2wsl2c++1ssh3github3服务器15git4webdav1obsidian1python2x2201cloudreve1Butterfly15
网站信息
文章数目 :
66
本站总字数 :
55.7k
本站访客数 :
本站总浏览量 :
最后更新时间 :
©2025 - 2026 By Diraw
框架 Hexo|主题 Butterfly
蜀ICP备2025147634号-1
载入天数...载入时分...
搜索
数据加载中