站点美化

本站主题自定义:

Waline配色

themes/stellar/source/css/_plugins/comments/waline.styl
1
2
3
4
5
6
7
8
 /* 主题色 */
--waline-theme-color: #3498db; /* $color-theme; */
--waline-active-color: #2ecc71; /* $color-hover; */
/* 布局颜色 */
--waline-bgcolor: #f2f2f2; /* fff */
@media (prefers-color-scheme: auto) /* dark */
.wl-count
color: #666; /* #fff */

页面居中

删掉第六行:

themes/stellar/source/css/_layout/main.styl
1
2
3
4
5
6
7
8
9
10
11
12
.l_main
position: relative
padding-bottom: "calc(1 * %s)" % var(--gap-l)
@media screen and (min-width: 1400px)
margin-left: "calc(2 * %s)" % var(--gap-l)

@media screen and (min-width: $device-mobile-max)
padding-top: "calc(1 * %s)" % var(--gap-l)
header
margin: 4rem 1rem 2rem
.logo-wrap
margin: 0

添加背景动态线条效果

layout.ejs<body>里添加代码

themes/stellar/layout/layout.ejs
1
2
3
4
<!--动态线条背景-->
<script type="text/javascript"
color="220,220,220" opacity='0.7' zIndex="-2" count="200" src="//cdn.bootcss.com/canvas-nest.js/1.0.0/canvas-nest.min.js">
</script>

其中:

  • color:表示线条颜色,三个数字分别为(R,G,B),默认:(0,0,0)

  • opacity:表示线条透明度(0~1),默认:0.5 - count:表示线条的总数量,默认:150

  • zIndex:表示背景的z-index属性,css属性用于控制所在层的位置,默认:-1

添加不蒜子统计

footer.ejs里引入busuanzi.js,插入至<%- layoutDiv() %>之前:

themes/stellar/layout/_partial/main/footer.ejs
1
2
3
<!--卜算子统计-->
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js">
</script>

修改404页面

404.ejs里用自定义svg图片替换原地址:

themes/stellar/layout/404.ejs
1
2
3
4
5
6
7
8
9
10
11
12
13
<article class='md-text error-page'>
<h1><img id='error' src='修改这里' alt='404'></h1>
<p class='what'>
<strong>
<%- __('page.error.what') %>
</strong>
</p>
<p class='why'>
<%- __('page.error.why') %>
</p>
<br><br>
<a class='button' id='back' href="<%- config.root %>"><%- __('page.error.action') %></a>
</article>

添加背景代码雨效果

本站未使用

新建 DigitalRain.js,写入以下代码:

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
window.onload = function(){
//获取画布对象
var canvas = document.getElementById("canvas");
//获取画布的上下文
var context =canvas.getContext("2d");
var s = window.screen;
var W = canvas.width = s.width;
var H = canvas.height;
//获取浏览器屏幕的宽度和高度
//var W = window.innerWidth;
//var H = window.innerHeight;
//设置canvas的宽度和高度
canvas.width = W;
canvas.height = H;
//每个文字的字体大小
var fontSize = 12;
//计算列
var colunms = Math.floor(W /fontSize);
//记录每列文字的y轴坐标
var drops = [];
//给每一个文字初始化一个起始点的位置
for(var i=0;i<colunms;i++){
drops.push(0);
}
//运动的文字
var str ="WELCOME TO WWW.ITRHX.COM";
//4:fillText(str,x,y);原理就是去更改y的坐标位置
//绘画的函数
function draw(){
context.fillStyle = "rgba(238,238,238,.08)";//遮盖层
context.fillRect(0,0,W,H);
//给字体设置样式
context.font = "600 "+fontSize+"px Georgia";
//给字体添加颜色
context.fillStyle = ["#33B5E5", "#0099CC", "#AA66CC", "#9933CC", "#99CC00", "#669900", "#FFBB33", "#FF8800", "#FF4444", "#CC0000"][parseInt(Math.random() * 10)];//randColor();可以rgb,hsl, 标准色,十六进制颜色
//写入画布中
for(var i=0;i<colunms;i++){
var index = Math.floor(Math.random() * str.length);
var x = i*fontSize;
var y = drops[i] *fontSize;
context.fillText(str[index],x,y);
//如果要改变时间,肯定就是改变每次他的起点
if(y >= canvas.height && Math.random() > 0.99){
drops[i] = 0;
}
drops[i]++;
}
};
function randColor(){//随机颜色
var r = Math.floor(Math.random() * 256);
var g = Math.floor(Math.random() * 256);
var b = Math.floor(Math.random() * 256);
return "rgb("+r+","+g+","+b+")";
}
draw();
setInterval(draw,35);
};

在主题文件的相关css文件中(以 Material X 1.2.1 主题为例,在\themes\material-x-1.2.1\source\less_main.less 文件末尾)添加以下代码:

1
2
3
4
5
6
7
8
9
10
canvas {
position: fixed;
right: 0px;
bottom: 0px;
min-width: 100%;
min-height: 100%;
height: auto;
width: auto;
z-index: -1;
}

然后在主题的 layout.ejs 文件中引入即可:

1
2
3
<!-- 数字雨 -->
<canvas id="canvas" width="1440" height="900" ></canvas>
<script type="text/javascript" src="/js/DigitalRain.js"></script>

©2022 渝ICP备2022011696号-2 | Build By SkyReeves | Powered By Hexo Stellar
本站由 提供CDN加速/云储存 |