hexo-theme-solitude 1.4.0 → 1.4.1

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.
@@ -0,0 +1,91 @@
1
+ #about-page
2
+ .author-content-item-group
3
+ &.column
4
+ display flex
5
+ flex-direction column
6
+ width 49%
7
+ justify-content space-between
8
+
9
+ +maxWidth768()
10
+ width 100% !important
11
+
12
+ &.mapAndInfo
13
+ width 59%
14
+
15
+ .author-content-item
16
+ +minWidth1300()
17
+ animation slide-in .6s 0s backwards
18
+
19
+ &.map
20
+ background var(--site-about-oneself-map--light) no-repeat center
21
+ min-height 160px
22
+ max-height 400px
23
+ position relative
24
+ overflow hidden
25
+ margin-bottom 0.5rem
26
+ height 60%
27
+ background-size 100%
28
+ transition 1s ease-in-out
29
+
30
+ .map-title
31
+ position absolute
32
+ bottom 0
33
+ left 0
34
+ width 100%
35
+ background var(--sco-maskbg)
36
+ padding 0.5rem 2rem
37
+ backdrop-filter saturate(180%) blur(20px)
38
+ transition 1s ease-in-out
39
+ font-size 20px
40
+ transform translateZ(0)
41
+
42
+ +maxWidth768()
43
+ padding 1rem
44
+
45
+ b
46
+ color var(--sco-fontcolor)
47
+
48
+ +maxWidth768()
49
+ margin-bottom 0
50
+
51
+ [data-theme=dark] &
52
+ background var(--site-about-oneself-map--dark) no-repeat center
53
+ background-size 100%
54
+
55
+ &:hover
56
+ background-size 120%
57
+ transition 4s ease-in-out
58
+ background-position-x 0
59
+ background-position-y 36%
60
+
61
+ .map-title
62
+ bottom -100%
63
+
64
+ .author-content-item.selfInfo
65
+ display flex
66
+ min-height 100px
67
+ max-height 400px
68
+ justify-content space-between
69
+ align-items center
70
+ flex-wrap wrap
71
+ height -webkit-fill-available
72
+ height 40%
73
+
74
+ +maxWidth1300()
75
+ height 70%
76
+
77
+ div
78
+ display flex
79
+ flex-direction column
80
+ margin .5rem 2rem .5rem 0
81
+
82
+ .selfInfo-title
83
+ opacity .8
84
+ font-size .6rem
85
+ line-height 1
86
+ margin-bottom 8px
87
+
88
+ .selfInfo-content
89
+ font-weight 700
90
+ font-size 34px
91
+ line-height 1
@@ -0,0 +1,25 @@
1
+ .author-content-item.personalities
2
+ overflow hidden
3
+ position relative
4
+ width 59%
5
+ +maxWidth768()
6
+ min-height 360px
7
+
8
+ .title2
9
+ font-size 36px
10
+ font-weight 700
11
+ line-height 1.1
12
+
13
+ .image
14
+ position absolute
15
+ right -40px
16
+ bottom -10rem
17
+ transition transform 2s cubic-bezier(.13, .45, .21, 1.02)
18
+ user-select none
19
+
20
+ +maxWidth768()
21
+ right -70px
22
+
23
+ &:hover
24
+ .image
25
+ transform rotate(-10deg)
@@ -0,0 +1,113 @@
1
+ #about-page
2
+ .author-content-item
3
+ &.single.reward
4
+ .author-content-item
5
+ .author-content-item-title
6
+ color var(--sco-red)
7
+
8
+ .reward-list-updateDate
9
+ color var(--sco-gray)
10
+ font-size 14px
11
+
12
+ .author-content-item-description
13
+ font-size 16px
14
+ margin-top .5rem
15
+
16
+ .reward-list-all
17
+ display flex
18
+ flex-wrap wrap
19
+ flex-direction row
20
+ margin 1rem -.25rem .5rem
21
+
22
+ .post-reward
23
+ position absolute
24
+ right 2rem
25
+ top 2rem
26
+
27
+ .reward-main
28
+ top 60px
29
+ right 0
30
+ left auto
31
+ bottom auto
32
+ width fit-content
33
+ box-shadow var(--sco-shadow-border)
34
+
35
+ .reward-all::before
36
+ bottom auto
37
+ top -16px
38
+
39
+ .reward-button
40
+ padding 8px 12px
41
+ background var(--sco-red)
42
+ border-radius 12px
43
+ color var(--sco-white)
44
+ display flex
45
+ align-items center
46
+ z-index 1
47
+ transition .3s
48
+ cursor pointer
49
+ box-shadow none
50
+ width fit-content
51
+ height fit-content
52
+ line-height 2
53
+ user-select none
54
+
55
+ +maxWidth768()
56
+ display none
57
+
58
+ &:hover
59
+ .reward-button
60
+ filter brightness(1.1)
61
+
62
+ .reward-list-item
63
+ padding 1rem
64
+ border-radius 12px
65
+ border var(--style-border-always)
66
+ width calc((100% / 6) - .5rem)
67
+ margin 0 .25rem .5rem .25rem
68
+ box-shadow var(--sco-shadow-border)
69
+ flex-direction column
70
+ justify-content space-between
71
+
72
+ +maxWidth1200()
73
+ width calc((100% / 4) - .5rem)
74
+
75
+ +maxWidth900()
76
+ width calc((100% / 2) - .5rem)
77
+
78
+ +maxWidth768()
79
+ width 100%
80
+
81
+ .reward-list-item-name
82
+ font-size 1rem
83
+ font-weight 700
84
+ line-height 1
85
+ margin-bottom .5rem
86
+ white-space nowrap
87
+ overflow hidden
88
+ text-overflow ellipsis
89
+
90
+ .reward-list-bottom-group
91
+ display flex
92
+ align-items center
93
+ justify-content space-between
94
+
95
+ .reward-list-item-money
96
+ padding 4px
97
+ background var(--sco-fontcolor)
98
+ color var(--sco-card-bg)
99
+ font-size 12px
100
+ line-height 1
101
+ border-radius 4px
102
+ margin-right 4px
103
+ white-space nowrap
104
+
105
+ .reward-list-item-time
106
+ font-size 12px
107
+ color var(--sco-secondtext)
108
+ white-space nowrap
109
+
110
+ .reward-list-tips
111
+ p
112
+ font-size 12px
113
+ color var(--sco-secondtext)
@@ -0,0 +1,75 @@
1
+ #about-page
2
+ .author-content-item.skills
3
+ display flex
4
+ justify-content center
5
+ align-items flex-start
6
+ flex-direction column
7
+ width 49%
8
+ min-height 450px
9
+
10
+ .tags-group-all
11
+ display flex
12
+ transform rotate(0)
13
+ transition .3s
14
+
15
+ .tags-group-wrapper
16
+ margin-top 20px
17
+ display flex
18
+ flex-wrap nowrap
19
+ animation rowup 60s linear infinite
20
+
21
+ .skills-style-group
22
+ position relative
23
+
24
+ .skills-list
25
+ display flex
26
+ opacity 0
27
+ transition .3s
28
+ position absolute
29
+ width 100%
30
+ top 0
31
+ left 0
32
+ flex-wrap wrap
33
+ flex-direction row
34
+ margin-top 10px
35
+
36
+ &:hover
37
+ .skills-style-group
38
+ .tags-group-all
39
+ opacity 0
40
+
41
+ .skills-list
42
+ opacity 1
43
+
44
+ .skill-info
45
+ display flex
46
+ align-items center
47
+ margin-right 10px
48
+ margin-top 10px
49
+ background var(--sco-background)
50
+ border-radius 40px
51
+ padding 4px 12px 4px 8px
52
+ border var(--style-border)
53
+ box-shadow var(--sco-shadow-border)
54
+
55
+ .etc
56
+ margin-right 10px
57
+ margin-top 10px
58
+
59
+ .skill-icon
60
+ width 32px
61
+ height 32px
62
+ border-radius 32px
63
+ display flex
64
+ align-items center
65
+ justify-content center
66
+ margin-right 8px
67
+ user-select none
68
+
69
+ img
70
+ width 18px
71
+ height 18px
72
+
73
+ .skill-name
74
+ font-weight 700
75
+ line-height 1
@@ -0,0 +1,55 @@
1
+ #about-page
2
+ .author-content-item
3
+ .card-content
4
+ z-index 2
5
+
6
+ .about-statistic
7
+ min-height 380px
8
+ width 39%
9
+ background-size cover
10
+ color var(--sco-white)
11
+ overflow hidden
12
+
13
+ &::after
14
+ box-shadow 0 -159px 173px 71px #0f1114 inset
15
+ position absolute
16
+ content ''
17
+ width 100%
18
+ height 100%
19
+ top 0
20
+ left 0
21
+
22
+ #statistic
23
+ font-size 16px
24
+ border-radius 15px
25
+ width 100%
26
+ color var(--sco-white)
27
+ display flex
28
+ justify-content space-between
29
+ flex-direction row
30
+ flex-wrap wrap
31
+ margin-top 1rem
32
+ margin-bottom 2rem
33
+
34
+ div
35
+ display flex
36
+ justify-content space-between
37
+ flex-direction column
38
+ width 50%
39
+ margin-bottom .5rem
40
+
41
+ span:first-child
42
+ opacity .8
43
+ font-size .6rem
44
+
45
+ span:last-child
46
+ font-weight 700
47
+ font-size 34px
48
+ line-height 1
49
+ white-space nowrap
50
+
51
+ .banner-button
52
+ background var(--sco-white-op)
53
+
54
+ .banner-button:hover
55
+ background var(--sco-theme)
@@ -21,13 +21,29 @@ if hexo-config('says.enable')
21
21
 
22
22
  @import "links.styl"
23
23
 
24
- if hexo-config('about')
25
- @import "about.styl"
26
- @import "about/index.styl"
24
+ @import "about/index.styl"
27
25
 
28
26
  if hexo-config('music.enable')
29
27
  @import "music.styl"
30
28
 
29
+ .author-content
30
+ display flex
31
+ flex-wrap wrap
32
+ justify-content space-between
33
+ width 100%
34
+ margin-top 1rem
35
+
36
+ +maxWidth768()
37
+ margin-top 0
38
+
39
+ .author-content-item
40
+ +maxWidth1300()
41
+ animation slide-in .6s 0s backwards
42
+ +maxWidth768()
43
+ width 100% !important
44
+ margin-top 1rem
45
+ padding 1rem
46
+
31
47
  .author-content.author-content-item.sharePage
32
48
  height 19rem
33
49
  background-size cover
@@ -7,6 +7,7 @@ const coverColor = () => {
7
7
 
8
8
  function handleApiColor(path) {
9
9
  const cacheGroup = JSON.parse(localStorage.getItem('Solitude')) || {};
10
+ console.log(cacheGroup)
10
11
  if (cacheGroup.postcolor && cacheGroup.postcolor[path]) {
11
12
  const color = cacheGroup.postcolor[path].value;
12
13
  const [r, g, b] = color.match(/\w\w/g).map(x => parseInt(x, 16));
@@ -18,30 +19,24 @@ function handleApiColor(path) {
18
19
 
19
20
  function img2color(src) {
20
21
  const apiUrl = coverColorConfig.api + encodeURIComponent(src);
21
-
22
22
  fetch(apiUrl)
23
23
  .then(response => response.json())
24
24
  .then(data => {
25
25
  const color = data.RGB;
26
26
  const [r, g, b] = color.match(/\w\w/g).map(x => parseInt(x, 16));
27
27
  setThemeColors(color, r, g, b);
28
- if (coverColorConfig.time !== 0) {
29
- cacheColor(src, color);
30
- }
28
+ const expirationTime = Date.now() + coverColorConfig.time;
29
+ const cacheGroup = saveToLocal.get('Solitude') || {};
30
+ cacheGroup.postcolor = cacheGroup.postcolor || {};
31
+ cacheGroup.postcolor[src] = {value: color, expiration: expirationTime};
32
+ localStorage.setItem('Solitude', JSON.stringify(cacheGroup));
31
33
  })
32
34
  .catch(error => {
33
35
  console.error('请检查API是否正常!\n' + error);
36
+ setThemeColors();
34
37
  });
35
38
  }
36
39
 
37
- function cacheColor(src, color) {
38
- const expirationTime = Date.now() + coverColorConfig.time;
39
- const cacheGroup = saveToLocal.get('Solitude') || {};
40
- cacheGroup.postcolor = cacheGroup.postcolor || {};
41
- cacheGroup.postcolor[src] = {value: color, expiration: expirationTime};
42
- localStorage.setItem('Solitude', JSON.stringify(cacheGroup));
43
- }
44
-
45
40
  function setThemeColors(value, r = null, g = null, b = null) {
46
41
  if (value) {
47
42
  document.documentElement.style.setProperty('--sco-main', value);
@@ -51,15 +46,17 @@ function setThemeColors(value, r = null, g = null, b = null) {
51
46
 
52
47
  if (r && g && b) {
53
48
  var brightness = Math.round(((parseInt(r) * 299) + (parseInt(g) * 587) + (parseInt(b) * 114)) / 1000);
54
- var cardContents = document.getElementsByClassName('card-content');
55
- var authorInfo = document.getElementsByClassName('author-info__sayhi');
56
- for (let i = 0; i < cardContents.length; i++) {
57
- cardContents[i].style.setProperty('--sco-card-bg', 'var(--sco-white)');
58
- }
49
+ if (brightness < 125) {
50
+ var cardContents = document.getElementsByClassName('card-content');
51
+ for (let i = 0; i < cardContents.length; i++) {
52
+ cardContents[i].style.setProperty('--sco-card-bg', 'var(--sco-white)');
53
+ }
59
54
 
60
- for (let i = 0; i < authorInfo.length; i++) {
61
- authorInfo[i].style.setProperty('background', 'var(--sco-white-op)');
62
- authorInfo[i].style.setProperty('color', 'var(--sco-white)');
55
+ var authorInfo = document.getElementsByClassName('author-info__sayhi');
56
+ for (let i = 0; i < authorInfo.length; i++) {
57
+ authorInfo[i].style.setProperty('background', 'var(--sco-white-op)');
58
+ authorInfo[i].style.setProperty('color', 'var(--sco-white)');
59
+ }
63
60
  }
64
61
  }
65
62
 
@@ -1,20 +1,21 @@
1
- const coverColor = () => {
1
+ function coverColor() {
2
2
  const path = document.getElementById("post-cover")?.src;
3
+
3
4
  if (path) {
4
5
  localColor(path);
5
6
  }
6
7
  }
7
8
 
8
- const localColor = (path) => {
9
+ function localColor(path) {
9
10
  const img = new Image();
10
11
  img.crossOrigin = "Anonymous";
11
12
  img.onload = function () {
12
13
  const canvas = document.createElement("canvas");
13
- canvas.width = img.width;
14
- canvas.height = img.height;
14
+ canvas.width = this.width;
15
+ canvas.height = this.height;
15
16
  const ctx = canvas.getContext("2d");
16
- ctx.drawImage(img, 0, 0);
17
- const data = ctx.getImageData(0, 0, img.width, img.height).data;
17
+ ctx.drawImage(this, 0, 0);
18
+ const data = ctx.getImageData(0, 0, this.width, this.height).data;
18
19
  const {r, g, b} = calculateRGB(data);
19
20
  let value = rgbToHex(r, g, b);
20
21
  if (getContrastYIQ(value) === "light") {
@@ -22,26 +23,9 @@ const localColor = (path) => {
22
23
  }
23
24
  setThemeColors(value, r, g, b);
24
25
  };
25
- img.onerror = function() {
26
- console.error('图片加载失败');
27
- };
28
26
  img.src = path;
29
27
  }
30
28
 
31
- function calculateRGB(data) {
32
- let r = 0, g = 0, b = 0;
33
- const step = 5;
34
- for (let i = 0; i < data.length; i += 4 * step) {
35
- r += data[i];
36
- g += data[i + 1];
37
- b += data[i + 2];
38
- }
39
- r = Math.floor(r / (data.length / 4 / step));
40
- g = Math.floor(g / (data.length / 4 / step));
41
- b = Math.floor(b / (data.length / 4 / step));
42
- return {r, g, b};
43
- }
44
-
45
29
  function rgbToHex(r, g, b) {
46
30
  return "#" + [r, g, b].map(x => x.toString(16).padStart(2, '0')).join('');
47
31
  }
@@ -98,57 +82,4 @@ function colorRgb(str) {
98
82
  } else {
99
83
  return sColor;
100
84
  }
101
- }
102
-
103
- function setThemeColors(value, r = null, g = null, b = null) {
104
- const cardContents = document.getElementsByClassName('card-content');
105
- const authorInfo = document.getElementsByClassName('author-info__sayhi');
106
-
107
- if (value) {
108
- document.documentElement.style.setProperty('--sco-main', value);
109
- document.documentElement.style.setProperty('--sco-main-op', value + '23');
110
- document.documentElement.style.setProperty('--sco-main-op-deep', value + 'dd');
111
- document.documentElement.style.setProperty('--sco-main-none', value + '00');
112
-
113
- if (r && g && b) {
114
- var brightness = Math.round(((parseInt(r) * 299) + (parseInt(g) * 587) + (parseInt(b) * 114)) / 1000);
115
- for (let i = 0; i < cardContents.length; i++) {
116
- cardContents[i].style.setProperty('--sco-card-bg', 'var(--sco-white)');
117
- }
118
-
119
- for (let i = 0; i < authorInfo.length; i++) {
120
- authorInfo[i].style.setProperty('background', 'var(--sco-white-op)');
121
- authorInfo[i].style.setProperty('color', 'var(--sco-white)');
122
- }
123
- }
124
-
125
- document.getElementById("coverdiv").classList.add("loaded");
126
- initThemeColor();
127
- } else {
128
- document.documentElement.style.setProperty('--sco-main', 'var(--sco-theme)');
129
- document.documentElement.style.setProperty('--sco-main-op', 'var(--sco-theme-op)');
130
- document.documentElement.style.setProperty('--sco-main-op-deep', 'var(--sco-theme-op-deep)');
131
- document.documentElement.style.setProperty('--sco-main-none', 'var(--sco-theme-none)');
132
- initThemeColor();
133
- }
134
- }
135
-
136
- function initThemeColor() {
137
- const currentTop = window.scrollY || document.documentElement.scrollTop;
138
- let themeColor;
139
- if (currentTop > 0) {
140
- themeColor = getComputedStyle(document.documentElement).getPropertyValue('--sco-card-bg');
141
- } else if (PAGE_CONFIG.is_post) {
142
- themeColor = getComputedStyle(document.documentElement).getPropertyValue('--sco-main');
143
- } else {
144
- themeColor = getComputedStyle(document.documentElement).getPropertyValue('--sco-background');
145
- }
146
- changeThemeColor(themeColor);
147
- }
148
-
149
- function changeThemeColor(color) {
150
- const meta = document.querySelector('meta[name="theme-color"]');
151
- if (meta) {
152
- meta.setAttribute('content', color);
153
- }
154
85
  }