hexo-theme-solitude 1.3.0 → 1.3.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.
package/_config.yml CHANGED
@@ -498,6 +498,13 @@ theme_color:
498
498
  light_op_deep: '#4259efdd' # 亮色模式透明深色
499
499
  light_none: '#4259ef01' # 亮色模式透明无色
500
500
 
501
+ # 主题显示模式调整
502
+ # 主题支持三种模式:自动切换、暗色模式、亮色模式
503
+ # --------------------------------------
504
+ display_mode:
505
+ type: auto # auto: 自动切换 / dark: 暗色模式 / light: 亮色模式
506
+ dark_universe: true # 暗色模式背景星空
507
+
501
508
  # 第三方设置
502
509
  thirdparty:
503
510
  # 字数统计
@@ -89,7 +89,7 @@ search:
89
89
 
90
90
  head:
91
91
  noscript: Please enable JavaScript to view the site
92
- console: 'Program: Hexo | Theme: Hexo-Theme-Solitude | Author: WangZhuoSco、YiFeng | Github: https://github.com/DuoSco/Hexo-theme-solitude | Version: v1.3.0 😄'
92
+ console: 'Program: Hexo | Theme: Hexo-Theme-Solitude | Author: WangZhuoSco、YiFeng | Github: https://github.com/DuoSco/Hexo-theme-solitude | Version: v1.3.1 😄'
93
93
 
94
94
  aside:
95
95
  postcount: 'Posts :'
@@ -88,7 +88,7 @@ search:
88
88
 
89
89
  head:
90
90
  noscript: 开启JavaScript才能访问本站哦~
91
- console: '程序:Hexo | 主题:Hexo-Theme-Solitude | 作者:王卓Sco、亦封 | Github: https://github.com/DuoSco/Hexo-theme-solitude | 版本:v1.3.0 😄'
91
+ console: '程序:Hexo | 主题:Hexo-Theme-Solitude | 作者:王卓Sco、亦封 | Github: https://github.com/DuoSco/Hexo-theme-solitude | 版本:v1.3.1 😄'
92
92
 
93
93
  aside:
94
94
  postcount: '文章总数 :'
@@ -3,9 +3,8 @@ extends includes/layout.pug
3
3
  block content
4
4
  main.layout#content-inner
5
5
  #archive
6
- .article-sort-title #{__('page.archives')}<sup>#{page.posts.find({ parent: { $exists: false } }).length}</sup>
6
+ .article-sort-title #{__('page.archives')}<sup>#{site.posts.find({ parent: { $exists: false } }).length}</sup>
7
7
  .article-sort
8
8
  include includes/mixins/articleSort
9
9
  include includes/mixins/pagination
10
- include includes/widgets/aside/aside
11
-
10
+ include includes/widgets/aside/aside
@@ -0,0 +1,40 @@
1
+ case theme.display_mode.type
2
+ when "auto"
3
+ script.
4
+ initTheme = () => {
5
+ let isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
6
+ const cachedMode = saveToLocal.get('theme');
7
+ if (cachedMode === undefined) {
8
+ const nowMode =
9
+ isDarkMode ? 'dark' : 'light'
10
+ document.documentElement.setAttribute('data-theme', nowMode);
11
+ } else {
12
+ document.documentElement.setAttribute('data-theme', cachedMode);
13
+ }
14
+ }
15
+ initTheme()
16
+ when "dark"
17
+ script.
18
+ initTheme = () => {
19
+ const cachedMode = saveToLocal.get('theme');
20
+ if (cachedMode === undefined)
21
+ document.documentElement.setAttribute('data-theme', 'dark');
22
+ else
23
+ document.documentElement.setAttribute('data-theme', cachedMode);
24
+ }
25
+ initTheme()
26
+ when "light"
27
+ script.
28
+ initTheme = () => {
29
+ const cachedMode = saveToLocal.get('theme');
30
+ if (cachedMode === undefined)
31
+ document.documentElement.setAttribute('data-theme', 'light');
32
+ else
33
+ document.documentElement.setAttribute('data-theme', cachedMode);
34
+ }
35
+ initTheme()
36
+
37
+ if theme.display_mode.dark_universe
38
+ script(src=cdn_url_for("/lib/universe.min.js"))
39
+ script.
40
+ dark()
@@ -81,6 +81,9 @@ if theme.comment.enable
81
81
  // pjax
82
82
  include ../widgets/third-party/pjax.pug
83
83
 
84
+ // theme
85
+ include ../body/mode
86
+
84
87
  // music
85
88
  if theme.music.enable
86
89
  script(src=cdn_url_for("/js/music.js"))
@@ -5,6 +5,7 @@ html(lang=config.language, data-theme="light")
5
5
  head
6
6
  include ./head.pug
7
7
  body#body(data-type=page.type)
8
+ canvas#universe
8
9
  // loading
9
10
  if theme.loading.fullpage
10
11
  include ./loading.pug
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-solitude",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "A beautiful, powerful, and efficient Hexo theme developed by the DuoSco team",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -464,7 +464,7 @@
464
464
  border-radius 5px
465
465
  margin 0 4px
466
466
 
467
- a
467
+ #page-header & a
468
468
  letter-spacing 0
469
469
  display flex
470
470
  align-items center
@@ -42,6 +42,20 @@
42
42
  --sco-hl-bg $hl_bg_dark
43
43
  --sco-hltools-bg $hltools_bg_dark
44
44
 
45
+ #universe
46
+ display block
47
+ position fixed
48
+ margin 0
49
+ padding 0
50
+ border 0
51
+ outline 0
52
+ left 0
53
+ top 0
54
+ width 100%
55
+ height 100%
56
+ pointer-events none
57
+ z-index 1
58
+
45
59
  [data-theme=light]
46
60
  --sco-theme $light_theme
47
61
  --sco-theme-op $light_theme_op
@@ -86,4 +100,6 @@
86
100
  --style-border-forever 2px solid var(--sco-main)
87
101
  --sco-navbg var(--sco-theme-op)
88
102
  --sco-hl-bg $hl_bg_light
89
- --sco-hltools-bg $hltools_bg_light
103
+ --sco-hltools-bg $hltools_bg_light
104
+ #universe
105
+ display none
@@ -224,6 +224,7 @@
224
224
  display flex
225
225
  width 100%
226
226
  height 100%
227
+ border none
227
228
  align-items center
228
229
 
229
230
  .img-alt
@@ -1,5 +1,5 @@
1
1
  body[data-type=music]
2
- #page-header.not-top-img #nav a
2
+ #page-header #nav a
3
3
  color var(--sco-white)
4
4
  #page-header.not-top-img #nav .back-home-button
5
5
  color var(--sco-white)
package/source/js/main.js CHANGED
@@ -458,21 +458,6 @@ let sco = {
458
458
  lightbox: function () {
459
459
  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)");
460
460
  },
461
- /**
462
- * 初始化
463
- */
464
- initTheme: function () {
465
- let isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
466
- const cachedMode = saveToLocal.get('theme');
467
- if (cachedMode === undefined) {
468
- const nowMode =
469
- isDarkMode ? 'dark' : 'light'
470
- document.documentElement.setAttribute('data-theme', nowMode);
471
- saveToLocal.set('theme', nowMode, 0.2);
472
- } else {
473
- document.documentElement.setAttribute('data-theme', cachedMode);
474
- }
475
- },
476
461
  /**
477
462
  *
478
463
  */
@@ -1035,8 +1020,6 @@ window.refreshFn = () => {
1035
1020
  GLOBAL_CONFIG.ai.enable && PAGE_CONFIG.page === "post" && ScoAI.init()
1036
1021
  }
1037
1022
 
1038
- sco.initTheme()
1039
-
1040
1023
  document.addEventListener('DOMContentLoaded', function () {
1041
1024
  window.refreshFn()
1042
1025
  })
@@ -0,0 +1 @@
1
+ function dark(){window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;var t,i,e,s,n=.05,h=document.getElementById("universe"),a=!0,o="226,225,224",r=[];function d(){t=window.innerWidth,i=window.innerHeight,e=.216*t,h.setAttribute("width",t),h.setAttribute("height",i)}function c(){s.clearRect(0,0,t,i);for(var e=r.length,n=0;n<e;n++){var h=r[n];h.move(),h.fadeIn(),h.fadeOut(),h.draw()}}function f(){this.reset=function(){this.giant=u(3),this.comet=!this.giant&&!a&&u(10),this.x=m(0,t-10),this.y=m(0,i),this.r=m(1.1,2.6),this.dx=m(n,6*n)+(this.comet+1-1)*n*m(50,120)+.1,this.dy=-m(n,6*n)-(this.comet+1-1)*n*m(50,120),this.fadingOut=null,this.fadingIn=!0,this.opacity=0,this.opacityTresh=m(.2,1-.4*(this.comet+1-1)),this.do=m(5e-4,.002)+.001*(this.comet+1-1)},this.fadeIn=function(){this.fadingIn&&(this.fadingIn=!(this.opacity>this.opacityTresh),this.opacity+=this.do)},this.fadeOut=function(){this.fadingOut&&(this.fadingOut=!(this.opacity<0),this.opacity-=this.do/2,(this.x>t||this.y<0)&&(this.fadingOut=!1,this.reset()))},this.draw=function(){if(s.beginPath(),this.giant)s.fillStyle="rgba(180,184,240,"+this.opacity+")",s.arc(this.x,this.y,2,0,2*Math.PI,!1);else if(this.comet){s.fillStyle="rgba("+o+","+this.opacity+")",s.arc(this.x,this.y,1.5,0,2*Math.PI,!1);for(var t=0;t<30;t++)s.fillStyle="rgba("+o+","+(this.opacity-this.opacity/20*t)+")",s.rect(this.x-this.dx/4*t,this.y-this.dy/4*t-2,2,2),s.fill()}else s.fillStyle="rgba(226,225,142,"+this.opacity+")",s.rect(this.x,this.y,this.r,this.r);s.closePath(),s.fill()},this.move=function(){this.x+=this.dx,this.y+=this.dy,!1===this.fadingOut&&this.reset(),(this.x>t-t/4||this.y<0)&&(this.fadingOut=!0)},setTimeout((function(){a=!1}),50)}function u(t){return Math.floor(1e3*Math.random())+1<10*t}function m(t,i){return Math.random()*(i-t)+t}d(),window.addEventListener("resize",d,!1),function(){s=h.getContext("2d");for(var t=0;t<e;t++)r[t]=new f,r[t].reset();c()}(),function t(){"dark"==document.getElementsByTagName("html")[0].getAttribute("data-theme")&&c(),window.requestAnimationFrame(t)}()}