diff --git a/_config.yml b/_config.yml index 78f4be6..1d31f81 100755 --- a/_config.yml +++ b/_config.yml @@ -27,20 +27,20 @@ sidebar: widgets: #### 自动生成的页面 #### # 主页 - home: search, welcome, recent, timeline # for home + home: search, recent, timeline # for home # 博客索引页 blog_index: search_blog, recent, timeline # for categories/tags/archives # 文档索引页 wiki_index: search_docs, recent, timeline # for wiki # 其它(404) - others: search, welcome, recent, timeline # for 404 and ... + others: search, recent, timeline # for 404 and ... #### 手动创建的页面 #### # 文章内页 - post: toc, ghrepo, search, ghissues # for pages using 'layout:post' + post: search_blog, toc, ghrepo, ghissues # for pages using 'layout:post' # 文档内页 wiki: search, ghrepo, toc, ghissues, related # for pages using 'layout:wiki' # 其它 layout:page 的页面 - page: welcome, toc, search # for custom pages using 'layout:page' + page: toc, search # for custom pages using 'layout:page' ######## Index ######## post-index: # 近期发布 分类 标签 归档 and ... @@ -340,26 +340,29 @@ style: text-align: left color: common: - theme: '#1BCDFC' # 主题色 - accent: '#ff5722' # 强调色 - link: '#2196f3' # 超链接颜色 - button: '#1BCDFC' # 按钮颜色 - hover: '#ff5722' # 按钮高亮颜色 + theme: 'hsl(192 98% 55%)' # 主题色 + accent: 'hsl(14 100% 57%)' # 强调色 + link: 'hsl(207 90% 54%)' # 超链接颜色 + button: 'hsl(192 98% 55%)' # 按钮颜色 + hover: 'hsl(14 100% 57%)' # 按钮高亮颜色 + # 动态颜色(会根据明暗主题重设明度值,只用关心色相和饱和度即可) + dynamic: + block: 'hsl(212 8% 95%)' # 块背景颜色 light: - background: '#F8F9FA' # 浅色背景颜色 - block: '#F0F1F2' # 块背景颜色 - card: white # 卡片背景颜色 - title: '#000' # 标题文本颜色 - text: '#333' # 正文文本颜色 - code: '#f33a00' # 行内代码颜色 + background: hsl(212 16% 98%) # 浅色背景颜色 + block: 'hsl(212 8% 95%)' # 块背景颜色 + card: 'white' # 卡片背景颜色 + title: 'black' # 标题文本颜色 + text: 'hsl(0 0% 20%)' # 正文文本颜色 + code: 'hsl(14 100% 48%)' # 行内代码颜色 dark: - background: '#313438' # 深色背景颜色 + background: 'hsl(212 6% 16%)' # 深色背景颜色 background-mobile: black # 移动端深色背景(OLED调成纯黑可以省电) - block: '#2B2F33' # 块背景颜色 - card: '#464D57' # 卡片背景颜色 - title: '#fff' # 标题文本颜色 - text: '#eee' # 正文文本颜色 - code: '#ff7043' # 行内代码颜色 + block: 'hsl(212 8% 20%)' # 块背景颜色 + card: 'hsl(212 10% 22%)' # 卡片背景颜色 + title: 'white' # 标题文本颜色 + text: 'hsl(0 0% 93%)' # 正文文本颜色 + code: 'hsl(14 100% 63%)' # 行内代码颜色 animated_avatar: animate: auto # auto, always background: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.2/avatar/round/rainbow64@3x.webp diff --git a/_data/widgets.yml b/_data/widgets.yml index 0f71538..bc07d2b 100644 --- a/_data/widgets.yml +++ b/_data/widgets.yml @@ -62,20 +62,6 @@ tagcloud: end_color: # 结束的颜色。您可使用十六进位值(#b700ff),rgba(rgba(183, 0, 255, 1)),hsla(hsla(283, 100%, 50%, 1))或 颜色关键字。此变量仅在 color 参数开启时才有用。 show_count: false # 显示每个标签的文章总数 -welcome: - layout: markdown - title: Stellar 入门指南 - content: | # support markdown - 欢迎使用 [Stellar](https://github.com/xaoxuu/hexo-theme-stellar/) 主题,下面是您的入门指南,祝您使用愉快! -
- **第一步** - 创建 `blog/_config.stellar.yml` 文件,在此文件中填写需要自定义的主题配置。 -
- **第二步** - 创建 `blog/source/_data/widgets.yml` 文件,此文件中填写需要自定义的侧边栏组件,例如 `welcome` 组件。 -
- 如果有任何疑问,请先查阅 [文档](https://xaoxuu.com/wiki/stellar/),如果文档中没有提供,请提 [issue](https://github.com/xaoxuu/hexo-theme-stellar/issues/) 向开发中询问。 - timeline: layout: timeline title: 近期动态 diff --git a/layout/_partial/sidebar/header.ejs b/layout/_partial/sidebar/header.ejs index 729d672..92c7ffa 100644 --- a/layout/_partial/sidebar/header.ejs +++ b/layout/_partial/sidebar/header.ejs @@ -10,10 +10,10 @@ function layoutTitle(main, url, sub) { if (sub) { let arr = sub.split('|'); if (arr.length > 1) { - el += '
' + arr[0].trim() + '
'; - el += '
' + arr[1].trim() + '
'; - } else if (arr.length > 0) { - el += '
' + arr[0] + '
'; + el += '
' + arr.shift().trim() + '
'; + el += '
' + arr.join('|') + '
'; + } else { + el += '
' + sub + '
'; } } el += ''; diff --git a/layout/_partial/sidebar/index.ejs b/layout/_partial/sidebar/index.ejs index 0ecff08..1c81660 100755 --- a/layout/_partial/sidebar/index.ejs +++ b/layout/_partial/sidebar/index.ejs @@ -40,10 +40,10 @@ function layoutTitle(main, url, sub) { if (sub) { let arr = sub.split('|'); if (arr.length > 1) { - el += '
' + arr[0].trim() + '
'; - el += '
' + arr[1].trim() + '
'; - } else if (arr.length > 0) { - el += '
' + arr[0] + '
'; + el += '
' + arr.shift().trim() + '
'; + el += '
' + arr.join('|') + '
'; + } else { + el += '
' + sub + '
'; } } el += ''; diff --git a/layout/_partial/widgets/search.ejs b/layout/_partial/widgets/search.ejs index 3fbfce4..4dbb500 100644 --- a/layout/_partial/widgets/search.ejs +++ b/layout/_partial/widgets/search.ejs @@ -27,6 +27,7 @@ function layoutDiv() { } else { el += ' placeholder="' + (item.placeholder || __('search.search')) + '">' } + el += '' el += '' el += '
' el += '
' + __('search.no_results') + '
' diff --git a/source/css/_custom.styl b/source/css/_custom.styl index 39e38c4..a3c8ea4 100644 --- a/source/css/_custom.styl +++ b/source/css/_custom.styl @@ -27,6 +27,8 @@ $dark-code = convert(hexo-config('style.color.dark.code')) $dark-background-mobile = convert(hexo-config('style.color.dark.background-mobile')) +$dynamic-block = convert(hexo-config('style.color.dynamic.block')) + // @font-face // font-family: 'Dosis' // src: url('https://fastly.jsdelivr.net/gh/volantis-x/cdn-fonts@20.5.30/Dosis/Dosis-Medium.ttf') @@ -64,7 +66,7 @@ $fs-p = $fs-15 $fs-code = $fs-13 $border-card = 12px -$border-block = 8px +$border-block = 6px $border-image = 6px // 可以动态变化的属性 diff --git a/source/css/_defines/theme.styl b/source/css/_defines/theme.styl index bf51919..a24f428 100644 --- a/source/css/_defines/theme.styl +++ b/source/css/_defines/theme.styl @@ -1,3 +1,7 @@ +$dynamic-block-h = hue($dynamic-block) +$dynamic-block-s = saturation($dynamic-block) +$dynamic-block-l = lightness($dynamic-block) + set_text_light() --text-p0: $dark-title --text-p1: mix($dark-text, $dark-background, 85) @@ -17,9 +21,10 @@ set_text_dark() :root --site-bg: $light-background --card: $light-card - --block: $light-block - --block-border: darken($light-block, 5) - --block-hover: darken($light-block, 2) + --block: hsl($dynamic-block-h, $dynamic-block-s, 95) + --block-border: hsl($dynamic-block-h, $dynamic-block-s, 90) + --block-hover: hsl($dynamic-block-h, $dynamic-block-s, 92) + --block-lighten: hsl($dynamic-block-h, $dynamic-block-s, 100) set_text_dark() --theme-highlight: darken($color-theme, 5) --theme-bg: mix($color-theme, $light-card, 10) @@ -29,18 +34,16 @@ set_darkmode() :root --site-bg: $dark-background --card: $dark-card - --block: $dark-block - --block-border: lighten($dark-block, 6) - --block-hover: darken($dark-block, 4) + --block: hsl($dynamic-block-h, $dynamic-block-s, 12) + --block-border: hsl($dynamic-block-h, $dynamic-block-s, 24) + --block-hover: hsl($dynamic-block-h, $dynamic-block-s, 9) + --block-lighten: hsl($dynamic-block-h, $dynamic-block-s, 30) set_text_light() --theme-highlight: $color-theme --theme-bg: mix($color-theme, $dark-card, 10) @media screen and (max-width: $device-mobile-max) --site-bg: $dark-background-mobile --card: darken($dark-card, 6) - --block: darken($dark-block, 4) - --block-border: lighten($dark-block, 2) - --block-hover: darken($dark-block,8) if hexo-config('style.darkmode') == 'auto' // 系统的dark模式 diff --git a/source/css/_layout/sidebar/header.styl b/source/css/_layout/sidebar/header.styl index 3c8095d..642cec2 100644 --- a/source/css/_layout/sidebar/header.styl +++ b/source/css/_layout/sidebar/header.styl @@ -5,9 +5,9 @@ nav.menu margin: 1rem 0 background: var(--block) + border: 1px solid var(--block-border) border-radius: 6px display: flex - padding: 1px flex-wrap: wrap &::-webkit-scrollbar display: none @@ -28,7 +28,7 @@ nav.menu text-align: center &.active, &:hover color: var(--text-p1) - background: var(--card) + background: var(--block-lighten) box-shadow: $boxshadow-button .l_left .menu a.nav-item diff --git a/source/css/_layout/tag-plugins/common.styl b/source/css/_layout/tag-plugins/common.styl index 21f059e..761db3e 100644 --- a/source/css/_layout/tag-plugins/common.styl +++ b/source/css/_layout/tag-plugins/common.styl @@ -5,7 +5,6 @@ set_text_white() --text-p3: #ddd --text-code: white --card: $dark-card - --block: $dark-block --block-border: lighten($dark-block, 6) --block-hover: darken($dark-block, 4) set_text_black() @@ -15,7 +14,6 @@ set_text_black() --text-p3: #555 --text-code: white --card: $light-card - --block: $light-block --block-border: darken($light-block, 5) --block-hover: darken($light-block, 2) diff --git a/source/css/_layout/tag-plugins/navbar.styl b/source/css/_layout/tag-plugins/navbar.styl index fc80ac5..4588b71 100644 --- a/source/css/_layout/tag-plugins/navbar.styl +++ b/source/css/_layout/tag-plugins/navbar.styl @@ -16,7 +16,7 @@ display: none &:hover background: var(--block) - &.active + &.active background: var(--block) box-shadow: none color: var(--text-p1) \ No newline at end of file diff --git a/source/css/_layout/widgets/ghuser.styl b/source/css/_layout/widgets/ghuser.styl index 2f2f366..eeb7c6c 100644 --- a/source/css/_layout/widgets/ghuser.styl +++ b/source/css/_layout/widgets/ghuser.styl @@ -52,21 +52,24 @@ .menu margin-bottom: 0 background: none - a:hover - box-shadow: none - background: var(--block) - a.active - box-shadow: none - position: relative - &:after - content: '' - position: absolute - height: 3px - bottom: 0 - width: 32px - left: 'calc(50% - 0.5 * %s)' % @width - border-radius: 4px - background: $color-theme + border: 0 + a + margin: 0 + &:hover + box-shadow: none + background: var(--block) + &.active + box-shadow: none + position: relative + &:after + content: '' + position: absolute + height: 3px + bottom: 0 + width: 32px + left: 'calc(50% - 0.5 * %s)' % @width + border-radius: 4px + background: $color-theme .buttons margin: 1rem 0 diff --git a/source/css/_layout/widgets/search.styl b/source/css/_layout/widgets/search.styl index a6109b0..b7795d8 100644 --- a/source/css/_layout/widgets/search.styl +++ b/source/css/_layout/widgets/search.styl @@ -1,3 +1,103 @@ .widgets .widget-wrapper.search - margin-top: 0 + margin-top: 1rem margin-bottom: 0 + +.search-wrapper + width: 100% + >.search-form + position: sticky + top: 1rem + display: flex + flex-direction: row + align-items: center + .search-input + width: 100% + padding: 0.5rem + line-height: 1 + box-sizing: border-box + border-radius: $border-block + background-color: var(--card) + color: var(--text-p0) + border: 1px solid var(--block-border) + &:focus + trans1 border-color + + &.noresult + .search-input + &:focus + border: 1px solid $c-red + .search-icon + color: $c-red + + .search-no-result + display: none + margin: 1em auto + color: var(--text-p1) + text-align: center + font-size: $fs-14 + padding: 2rem + background: var(--block) + border-radius: $border-block + + #search-result + ul.search-result-list + padding: 0 + margin: 0 + list-style-type: none + li + margin: 1em auto + &:hover + .search-result-title + color: $color-hover + .search-result-title + color: var(--text-p1) + font-weight: 700 + line-height: 1.2 + + .search-result-content + overflow: hidden + color: var(--text-p3) + margin: .4em auto + max-height: 13em + text-align: justify + font-size: $fs-12 + line-height: 1.2 + display: -webkit-box + -webkit-box-orient: vertical + overflow: hidden + -webkit-line-clamp: 3 + + .search-keyword + border-bottom: 1px dashed $color-hover + color: $color-hover + font-weight: bold + + + +.search-wrapper.noresult + .search-no-result + display: block + +.widget-wrapper + .search-form + top: 0 + background: var(--site-bg) + .search-input + margin-top: 1rem + margin-bottom: -1rem + padding-left: 1.75rem + .search-icon + margin-top: 1rem + margin-bottom: -1rem + position: absolute + margin-left: 0.5rem + left: 0 + pointer-events: none + color: var(--text-p2) + + #search-result,.search-no-result + margin-top: 2rem + +.widget-wrapper:not(:first-child) + .search-wrapper + margin-top: -1rem \ No newline at end of file diff --git a/source/css/_plugins/index.styl b/source/css/_plugins/index.styl index c8db7cc..135bb27 100644 --- a/source/css/_plugins/index.styl +++ b/source/css/_plugins/index.styl @@ -8,9 +8,6 @@ if hexo-config('plugins.scrollreveal.enable') if hexo-config('plugins.fancybox.enable') @import 'fancybox' -// 搜索 -if hexo-config('search.service') == 'local_search' - @import 'search/local-search' // 评论 if hexo-config('comments.service') == 'beaudar' diff --git a/source/css/_plugins/search/local-search.styl b/source/css/_plugins/search/local-search.styl deleted file mode 100644 index 1ccde73..0000000 --- a/source/css/_plugins/search/local-search.styl +++ /dev/null @@ -1,87 +0,0 @@ -.search-wrapper - width: 100% - >.search-form - position: sticky - top: 1rem - .search-input - width: 100% - padding: 0.75rem 1rem - line-height: 1 - box-sizing: border-box - border-radius: $border-block - background-color: var(--card) - color: var(--text-p0) - box-shadow: $boxshadow-button - trans1 box-shadow - &:hover - box-shadow: 0 0 2px 0px rgba(0, 0, 0, 0.16), 0 0 8px 0px rgba(0, 0, 0, 0.08) - - &.noresult - .search-input - &:hover - box-shadow: 0 0 2px 0px alpha($c-red, 0.2), 0 0 8px 0px alpha($c-red, 0.2) - &:focus - box-shadow: 0 0 2px 0px alpha($c-red, 0.5), 0 0 8px 0px alpha($c-red, 0.4) - - .search-no-result - display: none - margin: 1em auto - color: var(--text-p1) - text-align: center - font-size: $fs-14 - padding: 2rem - background: var(--block) - border-radius: $border-block - - #search-result - ul.search-result-list - padding: 0 - margin: 0 - list-style-type: none - li - margin: 1em auto - &:hover - .search-result-title - color: $color-hover - .search-result-title - color: var(--text-p1) - font-weight: 700 - line-height: 1.2 - - .search-result-content - overflow: hidden - color: var(--text-p3) - margin: .4em auto - max-height: 13em - text-align: justify - font-size: $fs-12 - line-height: 1.2 - display: -webkit-box - -webkit-box-orient: vertical - overflow: hidden - -webkit-line-clamp: 3 - - .search-keyword - border-bottom: 1px dashed $color-hover - color: $color-hover - font-weight: bold - - - -.search-wrapper.noresult - .search-no-result - display: block - -.widget-wrapper - .search-form - top: 0 - background: var(--site-bg) - .search-input - margin-top: 1rem - margin-bottom: -1rem - #search-result,.search-no-result - margin-top: 2rem - -.widget-wrapper:not(:first-child) - .search-wrapper - margin-top: -1rem \ No newline at end of file