hexo-theme-solitude 2.0.9 → 2.0.11
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/.github/PULL_REQUEST_TEMPLATE.md +1 -8
- package/CONTRIBUTING.md +1 -1
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/README_zh-Hans.md +3 -3
- package/README_zh-Hant.md +2 -2
- package/SECURITY.md +4 -4
- package/_config.yml +20 -29
- package/layout/includes/console.pug +1 -1
- package/layout/includes/inject/body.pug +104 -100
- package/layout/includes/nav.pug +2 -2
- package/layout/includes/widgets/aside/aside.pug +1 -1
- package/layout/includes/widgets/home/postList.pug +1 -20
- package/layout/includes/widgets/home/topGroup.pug +5 -5
- package/layout/includes/widgets/page/links/banner.pug +1 -2
- package/layout/includes/widgets/post/copyright.pug +1 -1
- package/layout/includes/widgets/randomlink.pug +1 -2
- package/package.json +5 -4
- package/plugins.yml +16 -5
- package/scripts/event/merge_config.js +415 -423
- package/scripts/helper/inject_head_js.js +13 -7
- package/scripts/tags/article.js +39 -0
- package/scripts/tags/chart.js +27 -0
- package/scripts/tags/gallery.js +1 -1
- package/scripts/tags/typeit.js +29 -0
- package/source/css/_global/function.styl +1 -1
- package/source/css/_layout/article-container.styl +2 -2
- package/source/css/_layout/console.styl +7 -4
- package/source/css/_layout/recent-post.styl +53 -75
- package/source/css/_page/_home/home-top.styl +8 -13
- package/source/css/_page/recentcomment.styl +1 -3
- package/source/css/_post/meta.styl +2 -2
- package/source/css/_tags/gallery.styl +2 -1
- package/source/css/var.styl +7 -7
- package/source/js/covercolor/local.js +10 -82
- package/source/js/main.js +1 -1
- package/source/js/utils.js +1 -7
- package/.editorconfig +0 -9
- package/.github/workflows/stale.yml +0 -19
@@ -12,93 +12,21 @@ function setDefaultThemeColors() {
|
|
12
12
|
}
|
13
13
|
|
14
14
|
const localColor = path => {
|
15
|
+
var colorThief = new ColorThief();
|
15
16
|
const img = new Image();
|
16
17
|
img.crossOrigin = "Anonymous";
|
17
|
-
img.onload = () => setThemeColors(
|
18
|
+
img.onload = () => setThemeColors(rgbToHex(colorThief.getColor(img)));
|
18
19
|
img.onerror = () => console.error('Image Error');
|
19
20
|
img.src = path;
|
20
21
|
}
|
21
22
|
|
22
|
-
const
|
23
|
-
|
24
|
-
const
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
return getContrastYIQ(value) === "light" ? LightenDarkenColor(value, -50) : LightenDarkenColor(value, 20);
|
30
|
-
}
|
31
|
-
|
32
|
-
function calculateRGB(data) {
|
33
|
-
let r = 0, g = 0, b = 0;
|
34
|
-
const step = 5;
|
35
|
-
for (let i = 0; i < data.length; i += 4 * step) {
|
36
|
-
r += data[i];
|
37
|
-
g += data[i + 1];
|
38
|
-
b += data[i + 2];
|
39
|
-
}
|
40
|
-
r = Math.floor(r / (data.length / 4 / step));
|
41
|
-
g = Math.floor(g / (data.length / 4 / step));
|
42
|
-
b = Math.floor(b / (data.length / 4 / step));
|
43
|
-
return {r, g, b};
|
44
|
-
}
|
45
|
-
|
46
|
-
function rgbToHex(r, g, b) {
|
47
|
-
return "#" + [r, g, b].map(x => x.toString(16).padStart(2, '0')).join('');
|
48
|
-
}
|
49
|
-
|
50
|
-
function LightenDarkenColor(col, amt) {
|
51
|
-
let usePound = false;
|
52
|
-
|
53
|
-
if (col[0] === "#") {
|
54
|
-
col = col.slice(1);
|
55
|
-
usePound = true;
|
56
|
-
}
|
57
|
-
|
58
|
-
const num = parseInt(col, 16);
|
59
|
-
const r = Math.min(255, Math.max(0, (num >> 16) + amt * 2));
|
60
|
-
const b = Math.min(255, Math.max(0, ((num >> 8) & 0xff) + amt * 2));
|
61
|
-
const g = Math.min(255, Math.max(0, (num & 0xff) + amt * 2));
|
62
|
-
|
63
|
-
return `${usePound ? "#" : ""}${(g | (b << 8) | (r << 16)).toString(16).padStart(6, "0")}`;
|
64
|
-
}
|
65
|
-
|
66
|
-
function getContrastYIQ(hexcolor) {
|
67
|
-
let colorrgb = colorRgb(hexcolor);
|
68
|
-
let colors = colorrgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
69
|
-
let red = colors[1];
|
70
|
-
let green = colors[2];
|
71
|
-
let blue = colors[3];
|
72
|
-
let brightness = (red * 299) + (green * 587) + (blue * 114);
|
73
|
-
brightness = brightness / 255000;
|
74
|
-
return brightness >= 0.5 ? "light" : "dark";
|
75
|
-
}
|
76
|
-
|
77
|
-
function colorRgb(str) {
|
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
|
-
}
|
23
|
+
const rgbToHex = ([r, g, b]) => {
|
24
|
+
const hex = '#' + [r, g, b].map(x => {
|
25
|
+
const component = Math.floor(x * 0.8);
|
26
|
+
const hexValue = component.toString(16);
|
27
|
+
return hexValue.length === 1 ? '0' + hexValue : hexValue;
|
28
|
+
}).join('');
|
29
|
+
return hex;
|
102
30
|
}
|
103
31
|
|
104
32
|
function setThemeColors(value, r = null, g = null, b = null) {
|
@@ -139,4 +67,4 @@ function setThemeColors(value, r = null, g = null, b = null) {
|
|
139
67
|
document.documentElement.style.setProperty('--efu-main-none', 'var(--efu-theme-none)');
|
140
68
|
initThemeColor();
|
141
69
|
}
|
142
|
-
}
|
70
|
+
}
|
package/source/js/main.js
CHANGED
@@ -666,7 +666,7 @@ window.refreshFn = () => {
|
|
666
666
|
runtime && sco.addRuntime();
|
667
667
|
[scrollFn, sidebarFn, sco.addPhotoFigcaption, sco.setTimeState, sco.tagPageActive, sco.categoriesBarActive, sco.listenToPageInputPress, sco.addNavBackgroundInit, sco.refreshWaterFall].forEach(fn => fn());
|
668
668
|
lazyload.enable && utils.lazyloadImg();
|
669
|
-
lightbox && utils.lightbox(document.querySelectorAll("#article-container img:not(.flink-avatar,.gallery-group img)"));
|
669
|
+
lightbox && utils.lightbox(document.querySelectorAll("#article-container img:not(.flink-avatar,.gallery-group img, .no-lightbox)"));
|
670
670
|
randomlink && randomLinksList();
|
671
671
|
post_ai && is_post && efu_ai.init();
|
672
672
|
sco.switchComments();
|
package/source/js/utils.js
CHANGED
@@ -101,12 +101,6 @@
|
|
101
101
|
},
|
102
102
|
isMobile: () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
|
103
103
|
isHidden: e => 0 === e.offsetHeight && 0 === e.offsetWidth,
|
104
|
-
addEventListenerPjax: (ele, event, fn, option = false) => {
|
105
|
-
ele.addEventListener(event, fn, option)
|
106
|
-
utils.addGlobalFn('pjax', () => {
|
107
|
-
ele.removeEventListener(event, fn, option)
|
108
|
-
})
|
109
|
-
},
|
110
104
|
animateIn: (ele, text) => {
|
111
105
|
Object.assign(ele.style, {display: 'block', animation: text});
|
112
106
|
},
|
@@ -205,4 +199,4 @@
|
|
205
199
|
},
|
206
200
|
}
|
207
201
|
window.utils = {...window.utils, ...utilsFn};
|
208
|
-
})()
|
202
|
+
})()
|
package/.editorconfig
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
name: 'Close stale issues and PRs'
|
2
|
-
on:
|
3
|
-
schedule:
|
4
|
-
- cron: '30 1 * * *'
|
5
|
-
|
6
|
-
jobs:
|
7
|
-
stale:
|
8
|
-
runs-on: ubuntu-latest
|
9
|
-
steps:
|
10
|
-
- uses: actions/stale@v5
|
11
|
-
with:
|
12
|
-
days-before-issue-stale: 30
|
13
|
-
days-before-pr-stale: -1
|
14
|
-
days-before-close: 7
|
15
|
-
stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
|
16
|
-
close-pr-message: 'This issue has not seen any activity since it was marked stale. Closing.'
|
17
|
-
stale-issue-label: 'Stale'
|
18
|
-
exempt-issue-labels: 'pinned,bug,enhancement,documentation,Plan'
|
19
|
-
operations-per-run: 1000
|