hexo-theme-solitude 1.1.0 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -19
- package/README_EN.md +98 -0
- package/_config.yml +124 -124
- package/layout/page/about.ejs +3 -1
- package/layout/page/circle.ejs +1 -1
- package/layout/page/echarts.ejs +1 -14
- package/layout/page/links.ejs +1 -1
- package/layout/page/rss.ejs +10 -8
- package/layout/partial/compoment/about/award.ejs +1 -1
- package/layout/partial/compoment/circle/angle.ejs +1 -1
- package/layout/partial/compoment/circle/content.ejs +8 -8
- package/layout/partial/compoment/dorakika/rightmenu.ejs +1 -1
- package/layout/partial/compoment/inject/body.ejs +1 -3
- package/layout/partial/compoment/inject/head.ejs +3 -4
- package/layout/partial/compoment/links/angle.ejs +2 -2
- package/layout/partial/compoment/post/award.ejs +30 -22
- package/layout/partial/compoment/post/copyright.ejs +10 -8
- package/layout/partial/compoment/post/postMeta.ejs +11 -9
- package/layout/partial/footer.ejs +8 -3
- package/layout/partial/nav.ejs +1 -1
- package/layout/post.ejs +3 -3
- package/package.json +2 -2
- package/scripts/helper/charts.js +45 -34
- package/scripts/helper/related_post.js +10 -3
- package/scripts/tags/fold.js +2 -3
- package/scripts/tags/note.js +6 -2
- package/scripts/tags/tabs.js +1 -1
- package/source/css/main.css +24 -159
- package/source/img/default.png +0 -0
- package/source/img/logo-horizontal_version.png +0 -0
- package/source/img/pwa/16.png +0 -0
- package/source/img/pwa/180.png +0 -0
- package/source/img/pwa/192.png +0 -0
- package/source/img/pwa/32.png +0 -0
- package/source/img/pwa/512.png +0 -0
- package/source/img/pwa/logo.png +0 -0
- package/source/img/pwa/siteicon/splash-1125x2436.png +0 -0
- package/source/img/pwa/siteicon/splash-1136x640.png +0 -0
- package/source/img/pwa/siteicon/splash-1170x2532.png +0 -0
- package/source/img/pwa/siteicon/splash-1179x2556.png +0 -0
- package/source/img/pwa/siteicon/splash-1242x2208.png +0 -0
- package/source/img/pwa/siteicon/splash-1242x2688.png +0 -0
- package/source/img/pwa/siteicon/splash-1248x2778.png +0 -0
- package/source/img/pwa/siteicon/splash-1290x2796.png +0 -0
- package/source/img/pwa/siteicon/splash-1334x750.png +0 -0
- package/source/img/pwa/siteicon/splash-1536x2048.png +0 -0
- package/source/img/pwa/siteicon/splash-1620x2160.png +0 -0
- package/source/img/pwa/siteicon/splash-1668x2224.png +0 -0
- package/source/img/pwa/siteicon/splash-1668x2388.png +0 -0
- package/source/img/pwa/siteicon/splash-1792x828.png +0 -0
- package/source/img/pwa/siteicon/splash-2048x1536.png +0 -0
- package/source/img/pwa/siteicon/splash-2048x2732.png +0 -0
- package/source/img/pwa/siteicon/splash-2160x1620.png +0 -0
- package/source/img/pwa/siteicon/splash-2208x1242.png +0 -0
- package/source/img/pwa/siteicon/splash-2224x1668.png +0 -0
- package/source/img/pwa/siteicon/splash-2388x1668.png +0 -0
- package/source/img/pwa/siteicon/splash-2436x1125.png +0 -0
- package/source/img/pwa/siteicon/splash-2532x1170.png +0 -0
- package/source/img/pwa/siteicon/splash-2556x1179.png +0 -0
- package/source/img/pwa/siteicon/splash-2688x1242.png +0 -0
- package/source/img/pwa/siteicon/splash-2732x2048.png +0 -0
- package/source/img/pwa/siteicon/splash-2778x1248.png +0 -0
- package/source/img/pwa/siteicon/splash-2796x1290.png +0 -0
- package/source/img/pwa/siteicon/splash-640x1136.png +0 -0
- package/source/img/pwa/siteicon/splash-750x1334.png +0 -0
- package/source/img/pwa/siteicon/splash-828x1792.png +0 -0
- package/source/img/solitude-show.jpg +0 -0
- package/source/js/extend/covercolor/local.js +104 -94
- package/source/js/main.js +19 -16
- package/source/lib/chuckle-post-ai.js +1 -1
- package/scripts/filter/katex.js +0 -25
- package/scripts/tags/expand.js +0 -4
- package/scripts/tags/hide.js +0 -70
- package/source/js/extend/covercolor/web.js +0 -137
package/source/css/main.css
CHANGED
@@ -4115,70 +4115,6 @@ blockquote.pullquote.right {
|
|
4115
4115
|
height: 100%
|
4116
4116
|
}
|
4117
4117
|
|
4118
|
-
.hide-block > .hide-button, .hide-inline > .hide-button {
|
4119
|
-
display: inline-block;
|
4120
|
-
padding: .3rem 1rem;
|
4121
|
-
background: #307af6;
|
4122
|
-
color: var(--sco-white)
|
4123
|
-
}
|
4124
|
-
|
4125
|
-
.hide-block > .hide-button.open, .hide-inline > .hide-button.open {
|
4126
|
-
display: none
|
4127
|
-
}
|
4128
|
-
|
4129
|
-
.hide-block > .hide-button.open + div, .hide-inline > .hide-button.open + div {
|
4130
|
-
display: block
|
4131
|
-
}
|
4132
|
-
|
4133
|
-
.hide-block > .hide-button.open + span, .hide-inline > .hide-button.open + span {
|
4134
|
-
display: inline
|
4135
|
-
}
|
4136
|
-
|
4137
|
-
.hide-block > .hide-content, .hide-inline > .hide-content {
|
4138
|
-
display: none
|
4139
|
-
}
|
4140
|
-
|
4141
|
-
.hide-inline > .hide-button {
|
4142
|
-
margin: 0 .3rem
|
4143
|
-
}
|
4144
|
-
|
4145
|
-
.hide-inline > .hide-content {
|
4146
|
-
margin: 0 .3rem
|
4147
|
-
}
|
4148
|
-
|
4149
|
-
.hide-block {
|
4150
|
-
margin: 0 0 .8rem
|
4151
|
-
}
|
4152
|
-
|
4153
|
-
.hide-toggle {
|
4154
|
-
margin-bottom: 1rem;
|
4155
|
-
border: 1px solid #f0f0f0
|
4156
|
-
}
|
4157
|
-
|
4158
|
-
.hide-toggle > .hide-button {
|
4159
|
-
padding: .3rem .5rem;
|
4160
|
-
background: #f0f0f0;
|
4161
|
-
color: #1f2d3d;
|
4162
|
-
cursor: pointer
|
4163
|
-
}
|
4164
|
-
|
4165
|
-
.hide-toggle > .hide-button > i {
|
4166
|
-
font-size: 1.2em;
|
4167
|
-
transition: all .3s ease 0s
|
4168
|
-
}
|
4169
|
-
|
4170
|
-
.hide-toggle > .hide-button.open i {
|
4171
|
-
transform: rotate(90deg)
|
4172
|
-
}
|
4173
|
-
|
4174
|
-
.hide-toggle > .hide-button.open + div {
|
4175
|
-
display: block
|
4176
|
-
}
|
4177
|
-
|
4178
|
-
.hide-toggle > .hide-content {
|
4179
|
-
display: none;
|
4180
|
-
margin: 1.5rem 1.2rem
|
4181
|
-
}
|
4182
4118
|
|
4183
4119
|
#article-container .inline-img {
|
4184
4120
|
display: inline;
|
@@ -4386,7 +4322,7 @@ blockquote.pullquote.right {
|
|
4386
4322
|
|
4387
4323
|
.note:not(.no-icon)::before {
|
4388
4324
|
position: absolute;
|
4389
|
-
top: calc(50% -
|
4325
|
+
top: calc(50% - 19px);
|
4390
4326
|
left: .7rem;
|
4391
4327
|
font-size: larger
|
4392
4328
|
}
|
@@ -4452,7 +4388,7 @@ blockquote.pullquote.right {
|
|
4452
4388
|
}
|
4453
4389
|
|
4454
4390
|
.note.primary:not(.no-icon)::before {
|
4455
|
-
content: "
|
4391
|
+
content: "\e060"
|
4456
4392
|
}
|
4457
4393
|
|
4458
4394
|
.note.primary:not(.no-icon):not(.modern)::before {
|
@@ -6018,6 +5954,17 @@ i.fab {
|
|
6018
5954
|
}
|
6019
5955
|
|
6020
5956
|
@media screen and (max-width: 768px) {
|
5957
|
+
#page-header #nav a:hover span.scoicon {
|
5958
|
+
opacity: 1 !important;
|
5959
|
+
}
|
5960
|
+
#page-header.not-top-img #nav a:hover {
|
5961
|
+
align-items: flex-end !important;
|
5962
|
+
}
|
5963
|
+
|
5964
|
+
#nav #site-name span{
|
5965
|
+
padding-left: 8px
|
5966
|
+
}
|
5967
|
+
|
6021
5968
|
#sidebar #sidebar-menus .menus_items li .site-page:hover {
|
6022
5969
|
background: var(--sco-main);
|
6023
5970
|
color: var(--sco-white)
|
@@ -6496,7 +6443,7 @@ a.console_switchbutton {
|
|
6496
6443
|
transition: .3s;
|
6497
6444
|
display: flex;
|
6498
6445
|
height: 35px;
|
6499
|
-
width: 70px;
|
6446
|
+
min-width: 70px;
|
6500
6447
|
justify-content: center;
|
6501
6448
|
align-items: flex-end;
|
6502
6449
|
text-shadow: none;
|
@@ -6504,6 +6451,13 @@ a.console_switchbutton {
|
|
6504
6451
|
cursor: pointer
|
6505
6452
|
}
|
6506
6453
|
|
6454
|
+
#nav #site-name img {
|
6455
|
+
height: 100%
|
6456
|
+
}
|
6457
|
+
#nav #site-name:hover img {
|
6458
|
+
opacity: 0
|
6459
|
+
}
|
6460
|
+
|
6507
6461
|
#search-button > a > span {
|
6508
6462
|
display: none
|
6509
6463
|
}
|
@@ -11299,7 +11253,8 @@ a.reward-main-btn:hover {
|
|
11299
11253
|
|
11300
11254
|
@media screen and (max-width: 768px) {
|
11301
11255
|
#quit-box {
|
11302
|
-
|
11256
|
+
z-index: 109;
|
11257
|
+
height: calc(100vh - 380px);
|
11303
11258
|
}
|
11304
11259
|
}
|
11305
11260
|
|
@@ -12345,7 +12300,7 @@ button.el-button.tk-cancel.el-button--default.el-button--small {
|
|
12345
12300
|
bottom: 0;
|
12346
12301
|
left: 0;
|
12347
12302
|
right: 0;
|
12348
|
-
z-index:
|
12303
|
+
z-index: 1003;
|
12349
12304
|
width: 100%;
|
12350
12305
|
margin: auto;
|
12351
12306
|
padding: 0
|
@@ -16327,94 +16282,4 @@ div#equipment {
|
|
16327
16282
|
|
16328
16283
|
a.bber-reply {
|
16329
16284
|
cursor: pointer
|
16330
|
-
}
|
16331
|
-
|
16332
|
-
/*
|
16333
|
-
* ai
|
16334
|
-
*/
|
16335
|
-
.post-ai {
|
16336
|
-
background: var(--ai-post-bg);
|
16337
|
-
border-radius: 12px;
|
16338
|
-
padding: 12px 16px;
|
16339
|
-
line-height: 1.3;
|
16340
|
-
border: 1px solid #e3e8f7bd;;
|
16341
|
-
margin-top: 10px;
|
16342
|
-
margin-bottom: 6px;
|
16343
|
-
transition: all .3s;
|
16344
|
-
-webkit-transition: all .3s;
|
16345
|
-
-moz-transition: all .3s;
|
16346
|
-
-ms-transition: all .3s;
|
16347
|
-
-o-transition: all .3s
|
16348
|
-
}
|
16349
|
-
|
16350
|
-
.ai-title {
|
16351
|
-
display: flex;
|
16352
|
-
color: var(--sco-fontcolor);
|
16353
|
-
border-radius: 8px;
|
16354
|
-
align-items: center;
|
16355
|
-
padding: 0 5px
|
16356
|
-
}
|
16357
|
-
|
16358
|
-
.ai-title i {
|
16359
|
-
font-weight: 800
|
16360
|
-
}
|
16361
|
-
|
16362
|
-
.ai-title-text {
|
16363
|
-
font-weight: 700;
|
16364
|
-
margin-left: 8px
|
16365
|
-
}
|
16366
|
-
|
16367
|
-
.ai-tag {
|
16368
|
-
font-size: 12px;
|
16369
|
-
background-color: var(--ai-tag-bg);
|
16370
|
-
color: rgba(255, 255, 255, .9);
|
16371
|
-
border-radius: 4px;
|
16372
|
-
margin-left: auto;
|
16373
|
-
line-height: 1;
|
16374
|
-
padding: 4px 5px;
|
16375
|
-
border: var(--ai-border)
|
16376
|
-
}
|
16377
|
-
|
16378
|
-
.ai-explanation {
|
16379
|
-
padding: 8px;
|
16380
|
-
margin-top: 11px;
|
16381
|
-
font-size: 16px;
|
16382
|
-
line-height: 1.4;
|
16383
|
-
border: 1px solid var(--sco-card-border);
|
16384
|
-
border-radius: 8px;
|
16385
|
-
}
|
16386
|
-
|
16387
|
-
.ai-btn-box {
|
16388
|
-
font-size: 16px;
|
16389
|
-
width: 100%;
|
16390
|
-
display: flex;
|
16391
|
-
flex-direction: row;
|
16392
|
-
flex-wrap: wrap
|
16393
|
-
}
|
16394
|
-
|
16395
|
-
.ai-btn-item {
|
16396
|
-
padding: 5px 10px;
|
16397
|
-
margin: 10px 16px 0 5px;
|
16398
|
-
width: fit-content;
|
16399
|
-
line-height: 1;
|
16400
|
-
background: var(--sco-card-btn-bg);
|
16401
|
-
border: var(--ai-border);
|
16402
|
-
color: var(--sco-fontcolor);
|
16403
|
-
border-radius: 6px 6px 6px 0;
|
16404
|
-
-webkit-border-radius: 6px 6px 6px 0;
|
16405
|
-
-moz-border-radius: 6px 6px 6px 0;
|
16406
|
-
-ms-border-radius: 6px 6px 6px 0;
|
16407
|
-
-o-border-radius: 6px 6px 6px 0;
|
16408
|
-
user-select: none;
|
16409
|
-
transition: all .3s;
|
16410
|
-
-webkit-transition: all .3s;
|
16411
|
-
-moz-transition: all .3s;
|
16412
|
-
-ms-transition: all .3s;
|
16413
|
-
-o-transition: all .3s
|
16414
|
-
}
|
16415
|
-
|
16416
|
-
.ai-btn-item:hover {
|
16417
|
-
background: var(--sco-main);
|
16418
|
-
color: var(--sco-white);
|
16419
|
-
cursor: pointer;
|
16420
16285
|
}
|
package/source/img/default.png
CHANGED
Binary file
|
Binary file
|
package/source/img/pwa/16.png
CHANGED
Binary file
|
package/source/img/pwa/180.png
CHANGED
Binary file
|
package/source/img/pwa/192.png
CHANGED
Binary file
|
package/source/img/pwa/32.png
CHANGED
Binary file
|
package/source/img/pwa/512.png
CHANGED
Binary file
|
package/source/img/pwa/logo.png
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,107 +1,113 @@
|
|
1
1
|
function coverColor() {
|
2
2
|
var path = document.getElementById("post-cover")?.src;
|
3
3
|
if (path !== undefined) {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
4
|
+
var img = new Image();
|
5
|
+
img.crossOrigin = "Anonymous";
|
6
|
+
img.src = path;
|
7
|
+
img.onload = function () {
|
8
|
+
var canvas = document.createElement("canvas");
|
9
|
+
canvas.width = this.width;
|
10
|
+
canvas.height = this.height;
|
11
|
+
var ctx = canvas.getContext("2d");
|
12
|
+
ctx.drawImage(this, 0, 0);
|
13
|
+
var data = ctx.getImageData(0, 0, this.width, this.height).data;
|
14
|
+
var colorCounts = {};
|
15
|
+
var dominantColor = '';
|
16
|
+
var maxCount = 0;
|
17
|
+
var step = 5;
|
18
|
+
for (var i = 0; i < data.length; i += 4 * step) {
|
19
|
+
var r = data[i];
|
20
|
+
var g = data[i + 1];
|
21
|
+
var b = data[i + 2];
|
22
|
+
var color = `${r},${g},${b}`;
|
23
|
+
|
24
|
+
colorCounts[color] = (colorCounts[color] || 0) + 1;
|
25
|
+
|
26
|
+
if (colorCounts[color] > maxCount) {
|
27
|
+
maxCount = colorCounts[color];
|
28
|
+
dominantColor = color;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
var rgb = dominantColor.split(',').map(c => parseInt(c, 10));
|
32
|
+
var value = "#" + rgb[0].toString(16) + rgb[1].toString(16) + rgb[2].toString(16);
|
33
|
+
if (getContrastYIQ(value) == "light") {
|
34
|
+
value = LightenDarkenColor(colorHex(value), -50)
|
35
|
+
}
|
36
|
+
|
37
|
+
document.documentElement.style.setProperty('--sco-main', value);
|
38
|
+
document.documentElement.style.setProperty('--sco-main-op', value + '23');
|
39
|
+
document.documentElement.style.setProperty('--sco-main-op-deep', value + 'dd');
|
40
|
+
document.documentElement.style.setProperty('--sco-main-none', value + '00');
|
41
|
+
initThemeColor()
|
42
|
+
document.getElementById("coverdiv").classList.add("loaded");
|
20
43
|
}
|
21
|
-
r = Math.floor(r / (data.length / 4 / step));
|
22
|
-
g = Math.floor(g / (data.length / 4 / step));
|
23
|
-
b = Math.floor(b / (data.length / 4 / step));
|
24
|
-
var value = "#" + r.toString(16) + g.toString(16) + b.toString(16);
|
25
|
-
if (getContrastYIQ(value) == "light") {
|
26
|
-
value = LightenDarkenColor(colorHex(value), -50)
|
27
|
-
}
|
28
|
-
|
29
|
-
document.documentElement.style.setProperty('--sco-main', value);
|
30
|
-
document.documentElement.style.setProperty('--sco-main-op', value + '23');
|
31
|
-
document.documentElement.style.setProperty('--sco-main-op-deep', value + 'dd');
|
32
|
-
document.documentElement.style.setProperty('--sco-main-none', value + '00');
|
33
|
-
initThemeColor()
|
34
|
-
document.getElementById("coverdiv").classList.add("loaded");
|
35
|
-
}
|
36
44
|
} else {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
45
|
+
document.documentElement.style.setProperty('--sco-main', 'var(--sco-theme)');
|
46
|
+
document.documentElement.style.setProperty('--sco-main-op', 'var(--sco-theme-op)');
|
47
|
+
document.documentElement.style.setProperty('--sco-main-op-deep', 'var(--sco-theme-op-deep)');
|
48
|
+
document.documentElement.style.setProperty('--sco-main-none', 'var(--sco-theme-none)');
|
49
|
+
initThemeColor()
|
42
50
|
}
|
43
|
-
|
44
|
-
|
51
|
+
}
|
45
52
|
|
46
|
-
|
53
|
+
function colorHex(colorString) {
|
47
54
|
const hexRegex = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
48
55
|
let color = colorString;
|
49
56
|
|
50
57
|
if (/^(rgb|RGB)/.test(color)) {
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
return "#" + hexArr.join("");
|
57
|
-
} else if (hexRegex.test(color)) {
|
58
|
-
const hexDigits = color.replace(/#/, "").split("");
|
59
|
-
if (hexDigits.length === 6) {
|
60
|
-
return color;
|
61
|
-
} else if (hexDigits.length === 3) {
|
62
|
-
const hexArr = hexDigits.map(c => c + c);
|
58
|
+
const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
|
59
|
+
const hexArr = colorArr.map(c => {
|
60
|
+
const hex = Number(c).toString(16);
|
61
|
+
return hex.length === 1 ? "0" + hex : hex;
|
62
|
+
});
|
63
63
|
return "#" + hexArr.join("");
|
64
|
-
|
64
|
+
} else if (hexRegex.test(color)) {
|
65
|
+
const hexDigits = color.replace(/#/, "").split("");
|
66
|
+
if (hexDigits.length === 6) {
|
67
|
+
return color;
|
68
|
+
} else if (hexDigits.length === 3) {
|
69
|
+
const hexArr = hexDigits.map(c => c + c);
|
70
|
+
return "#" + hexArr.join("");
|
71
|
+
}
|
65
72
|
}
|
66
73
|
return color;
|
67
|
-
|
68
|
-
|
74
|
+
}
|
69
75
|
|
70
76
|
|
71
77
|
function colorRgb(str) {
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
78
|
+
const HEX_SHORT_REGEX = /^#([0-9a-fA-f]{3})$/;
|
79
|
+
const HEX_LONG_REGEX = /^#([0-9a-fA-f]{6})$/;
|
80
|
+
const HEX_SHORT_LENGTH = 4;
|
81
|
+
|
82
|
+
if (!str || typeof str !== 'string') {
|
83
|
+
return str;
|
84
|
+
}
|
85
|
+
|
86
|
+
const sColor = str.toLowerCase();
|
87
|
+
let hexValue = "";
|
88
|
+
|
89
|
+
if (sColor && (HEX_SHORT_REGEX.test(sColor) || HEX_LONG_REGEX.test(sColor))) {
|
90
|
+
hexValue = sColor.length === HEX_SHORT_LENGTH ?
|
91
|
+
sColor.replace(/^#(.)/g, "#$1$1") :
|
92
|
+
sColor;
|
93
|
+
|
94
|
+
const rgbValue = hexValue.slice(1)
|
95
|
+
.match(/.{2}/g)
|
96
|
+
.map(val => parseInt(val, 16));
|
97
|
+
|
98
|
+
return `rgb(${rgbValue[0]}, ${rgbValue[1]}, ${rgbValue[2]})`;
|
99
|
+
} else {
|
100
|
+
return sColor;
|
101
|
+
}
|
96
102
|
}
|
97
103
|
|
98
104
|
|
99
|
-
|
105
|
+
function LightenDarkenColor(col, amt) {
|
100
106
|
let usePound = false;
|
101
107
|
|
102
108
|
if (col[0] === "#") {
|
103
|
-
|
104
|
-
|
109
|
+
col = col.slice(1);
|
110
|
+
usePound = true;
|
105
111
|
}
|
106
112
|
|
107
113
|
const num = parseInt(col, 16);
|
@@ -110,12 +116,15 @@ function colorRgb(str) {
|
|
110
116
|
const g = Math.min(255, Math.max(0, (num & 0xff) + amt));
|
111
117
|
|
112
118
|
return `${usePound ? "#" : ""}${(g | (b << 8) | (r << 16)).toString(16).padStart(6, "0")}`;
|
113
|
-
|
119
|
+
}
|
114
120
|
|
115
121
|
|
116
|
-
|
122
|
+
function getContrastYIQ(hexcolor) {
|
117
123
|
var colorrgb = colorRgb(hexcolor);
|
118
124
|
var colors = colorrgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
125
|
+
if (!colors) {
|
126
|
+
return "light"; // or "dark", depending on your preference
|
127
|
+
}
|
119
128
|
var red = colors[1];
|
120
129
|
var green = colors[2];
|
121
130
|
var blue = colors[3];
|
@@ -123,28 +132,29 @@ function colorRgb(str) {
|
|
123
132
|
brightness = (red * 299) + (green * 587) + (blue * 114);
|
124
133
|
brightness = brightness / 255000;
|
125
134
|
if (brightness >= 0.5) {
|
126
|
-
|
135
|
+
return "light";
|
127
136
|
} else {
|
128
|
-
|
137
|
+
return "dark";
|
129
138
|
}
|
130
|
-
|
139
|
+
}
|
140
|
+
|
131
141
|
|
132
|
-
|
142
|
+
function initThemeColor() {
|
133
143
|
const currentTop = window.scrollY || document.documentElement.scrollTop;
|
134
144
|
let themeColor;
|
135
145
|
if (currentTop > 0) {
|
136
|
-
|
146
|
+
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--sco-card-bg');
|
137
147
|
} else if (PAGECONFIG.is_post) {
|
138
|
-
|
148
|
+
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--sco-main');
|
139
149
|
} else {
|
140
|
-
|
150
|
+
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--sco-background');
|
141
151
|
}
|
142
152
|
changeThemeColor(themeColor);
|
143
|
-
|
153
|
+
}
|
144
154
|
|
145
|
-
|
155
|
+
function changeThemeColor(color) {
|
146
156
|
const meta = document.querySelector('meta[name="theme-color"]');
|
147
157
|
if (meta) {
|
148
|
-
|
158
|
+
meta.setAttribute('content', color);
|
149
159
|
}
|
150
|
-
|
160
|
+
}
|
package/source/js/main.js
CHANGED
@@ -531,12 +531,12 @@ class sco {
|
|
531
531
|
'light'
|
532
532
|
if (nowMode === 'light') {
|
533
533
|
document.documentElement.setAttribute('data-theme', 'dark')
|
534
|
-
saveToLocal.set('theme', 'dark', 0.
|
534
|
+
saveToLocal.set('theme', 'dark', 0.04);
|
535
535
|
utils.snackbarShow(GLOBALCONFIG.lang.theme.dark, false, 2000)
|
536
536
|
document.querySelector(".menu-darkmode-text").textContent = "深色模式";
|
537
537
|
} else {
|
538
538
|
document.documentElement.setAttribute('data-theme', 'light')
|
539
|
-
saveToLocal.set('theme', 'light', 0.
|
539
|
+
saveToLocal.set('theme', 'light', 0.04);
|
540
540
|
utils.snackbarShow(GLOBALCONFIG.lang.theme.light, false, 2000)
|
541
541
|
document.querySelector(".menu-darkmode-text").textContent = "浅色模式";
|
542
542
|
}
|
@@ -564,25 +564,28 @@ class sco {
|
|
564
564
|
}
|
565
565
|
}
|
566
566
|
|
567
|
-
static copyPageUrl() {
|
568
|
-
utils.copy(window.location.href)
|
569
|
-
}
|
570
|
-
|
571
567
|
static lightbox(el) {
|
572
568
|
window.ViewImage && window.ViewImage.init("#article-container img:not(.flink-avatar), .bber-content-img img, #album_detail img, #equipment img, #twikoo .tk-content img:not(.tk-owo-emotion)");
|
573
569
|
}
|
574
570
|
|
575
571
|
static initTheme() {
|
576
572
|
const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
573
|
+
try {
|
574
|
+
const cachedMode = saveToLocal.get('theme');
|
575
|
+
if (cachedMode === undefined) {
|
576
|
+
const nowMode =
|
577
|
+
isDarkMode ? 'dark' : 'light'
|
578
|
+
document.documentElement.setAttribute('data-theme', nowMode);
|
579
|
+
saveToLocal.set('theme', nowMode, 0.5);
|
580
|
+
} else {
|
581
|
+
document.documentElement.setAttribute('data-theme', cachedMode);
|
582
|
+
}
|
583
|
+
} catch (e) {
|
584
|
+
if (isDarkMode) {
|
585
|
+
saveToLocal.set('theme', 'dark', 0.5)
|
586
|
+
} else {
|
587
|
+
saveToLocal.set('theme', 'light', 0.5)
|
588
|
+
}
|
586
589
|
}
|
587
590
|
}
|
588
591
|
|
@@ -758,7 +761,7 @@ class hightlight {
|
|
758
761
|
$expand[0].setAttribute('style', 'display:block')
|
759
762
|
}
|
760
763
|
if (itemHeight < 200) {
|
761
|
-
$table.setAttribute('style', 'height:'
|
764
|
+
$table.setAttribute('style', 'height: auto')
|
762
765
|
} else {
|
763
766
|
$table.setAttribute('style', 'height:200px')
|
764
767
|
ele.classList.remove("expand-done")
|