[opt] style

This commit is contained in:
xaoxuu 2024-01-31 13:58:56 +08:00
parent 0cab2f1405
commit 82684f203c
11 changed files with 61 additions and 63 deletions

View File

@ -499,8 +499,6 @@ style:
link: 'hsl(207 90% 54%)' # 超链接颜色 link: 'hsl(207 90% 54%)' # 超链接颜色
button: 'hsl(192 98% 55%)' # 按钮颜色 button: 'hsl(192 98% 55%)' # 按钮颜色
hover: 'hsl(14 100% 57%)' # 按钮高亮颜色 hover: 'hsl(14 100% 57%)' # 按钮高亮颜色
link:
underline: true # true / false
animated_avatar: animated_avatar:
animate: auto # auto, always animate: auto # auto, always
background: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/avatar/round/rainbow64@3x.webp background: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/avatar/round/rainbow64@3x.webp

View File

@ -32,14 +32,14 @@ function layoutDiv() {
if (top.trim().length == 0 && bottom.length == 0) { if (top.trim().length == 0 && bottom.length == 0) {
return `` return ``
} }
var style = ``
var el = `` var el = ``
el += `<div class="article banner top">` el += `<div class="article banner top">`
if (banner_url.length > 0) { if (banner_url.length > 0) {
el += `<img class="bg" src="${banner_url}">` el += `<img class="bg" src="${banner_url}">`
} if (page.poster?.color) {
var style = `` style += ' style="--text-banner:' + page.poster?.color + '"'
if (page.poster?.color) { }
style += ' style="--text-banner:' + page.poster?.color + '"'
} }
el += ` el += `
<div class="content"${style}> <div class="content"${style}>

View File

@ -9,7 +9,7 @@ function layoutDiv() {
// 2.left // 2.left
el += `<div class="left">` el += `<div class="left">`
// 3.left.top: 面包屑导航 // 3.left.top: 面包屑导航
el += `<div id="breadcrumb">` el += `<div class="flex-row" id="breadcrumb">`
// 首页 // 首页
el += `<a class="cap breadcrumb" href="${url_for(config.root)}">${__("btn.home")}</a>` el += `<a class="cap breadcrumb" href="${url_for(config.root)}">${__("btn.home")}</a>`
if (theme.wiki.tree[page.wiki]) { if (theme.wiki.tree[page.wiki]) {

View File

@ -28,12 +28,6 @@ function layoutDiv() {
}) })
} }
} }
const author = theme.authors ? (theme.authors[page.author] || theme.default_author) : null
if (author) {
el += `<span class="dot"></span>`
const link = `<a href="${url_for(author.path)}">${author.name}</a>`
el += `<span class="author">${link}</span>`
}
return el return el
} }
%> %>

View File

@ -2,19 +2,24 @@
function layoutDiv() { function layoutDiv() {
// 作者 // 作者
var el = '' var el = ''
el += `<div id="post-meta">` el += `<div class="flex-row" id="post-meta">`
if (page.wiki) { if (page.wiki) {
el += `<span class="created">${__("meta.updated") + __("symbol.colon")}</span>` el += `<span class="text created">${__("meta.updated") + __("symbol.colon")}`
el += `<time datetime="${date_xml(page.updated)}">${date(page.updated, config.date_format)}</time>` el += `<time datetime="${date_xml(page.updated)}">${date(page.updated, config.date_format)}</time>`
el += `</span>` el += `</span>`
} else { } else {
const author = theme.authors ? (theme.authors[page.author] || theme.default_author) : null
if (author) {
el += `<a class="author" href="${url_for(author.path)}">${author.name}</a>`
el += `<span class="sep"></span>`
}
// 发布日期 // 发布日期
el += `<span class="created">${__("meta.created") + __("symbol.colon")}</span>` el += `<span class="text created">${__("meta.created") + __("symbol.colon")}`
el += `<time datetime="${date_xml(page.date)}">${date(page.date, config.date_format)}</time>` el += `<time datetime="${date_xml(page.date)}">${date(page.date, config.date_format)}</time>`
el += `</span>` el += `</span>`
// 更新日期 // 更新日期
el += `<span class="updated">` el += `<span class="sep updated"></span>`
el += `<span class="dot"></span>` el += `<span class="text updated">`
el += `${__("meta.updated") + __("symbol.colon")}` el += `${__("meta.updated") + __("symbol.colon")}`
el += `<time datetime="${date_xml(page.updated)}">${date(page.updated, config.date_format)}</time>` el += `<time datetime="${date_xml(page.updated)}">${date(page.updated, config.date_format)}</time>`
el += `</span>` el += `</span>`

View File

@ -116,35 +116,13 @@
.md-text .md-text
p:not([class]), li:not([class]) p:not([class]), li:not([class])
a:not([class]) a:not([class])
position: relative padding: 0 2px
padding: 2px 0 margin: 0 -2px
text-decoration: none border-radius: 2px
line-height: 1.2 trans1 all
&:before text-decoration: underline
content: ''
position: absolute
border-radius: 2px
bottom: 0
left: 0
right: 0
height: 1px
if hexo-config('style.link.underline') == true
opacity: 0.8
else
opacity: 0
background: var(--theme-link)
trans1: all
&:hover &:hover
border-bottom: none color: $color-hover
color: var(--theme-link)
z-index 0
&:before
height: 100%
opacity: 0.2
z-index -1
bottom: 0
left: -2px
right: -2px
&:has(img) &:has(img)
&:before text-decoration: none
content: none padding: 0

View File

@ -1,6 +1,6 @@
.article.banner .article.banner
--text-banner: var(--text-p0) --text-banner: var(--text-p0)
--hover-bg: rgba(black, 0.08) --button-hover-bg: rgba(black, 0.08)
background: var(--block) background: var(--block)
margin: 0 margin: 0
height: unset height: unset
@ -8,7 +8,7 @@
.article.banner .article.banner
.bg+.content .bg+.content
--text-banner: white --text-banner: white
--hover-bg: rgba(white, 0.2) --button-hover-bg: rgba(white, 0.2)
background: rgba(black, 0.1) background: rgba(black, 0.1)
.article.banner .content .article.banner .content
@ -18,6 +18,29 @@
.title .title
font-size: $fs-h1 font-size: $fs-h1
color: var(--text-banner) color: var(--text-banner)
.bottom
padding: 1.5rem 1rem
h1 h1
line-height: 1.2 line-height: 1.2
margin: 0 margin: 0
//
.article.banner
.bg+.content
trans1 all
--blur-bg: rgba(black, 0.1)
--blur-px: 0px
--blur-sat: 100%
background: var(--blur-bg)
@supports ((-webkit-backdrop-filter:blur(var(--blur-px))) or (backdrop-filter:blur(var(--blur-px))))
background: var(--blur-bg)
backdrop-filter: saturate(var(--blur-sat)) blur(var(--blur-px))
-webkit-backdrop-filter: saturate(var(--blur-sat)) blur(var(--blur-px))
&:hover
.bg+.content
--blur-bg: rgba(black, 0.2)
--blur-px: 20px
--blur-sat: 150%

View File

@ -3,7 +3,8 @@
font-weight: 500 font-weight: 500
display: flex display: flex
justify-content: space-between justify-content: space-between
div#breadcrumb color: var(--text-banner)
.flex-row
display: flex display: flex
align-items: baseline align-items: baseline
flex-direction: row flex-direction: row
@ -11,20 +12,19 @@
color: var(--text-banner) color: var(--text-banner)
padding: 4px padding: 4px
border-radius: 2px border-radius: 2px
&:hover
background: var(--button-hover-bg)
span span
color: var(--text-banner) color: var(--text-banner)
span.sep span.sep
opacity 0.5 opacity 0.5
margin: 0 margin: 0
span.dot:before span.text
opacity 0.5
margin: 0 8px
a:hover
background: var(--hover-bg)
div#post-meta
padding: 4px padding: 4px
color: var(--text-banner)
div#post-meta
span.sep:before
content: '|'
span.updated span.updated
visibility: hidden visibility: hidden
&:hover &:hover

View File

@ -1,5 +1,5 @@
.l_left .l_left
margin: 8px margin-right: 8px
height: 'calc(%s - 16px)' % 100vh height: 'calc(%s - 16px)' % 100vh
border-radius: $border-card border-radius: $border-card
overflow: hidden overflow: hidden

View File

@ -123,5 +123,5 @@
@media screen and (max-width: $device-mobile-max) @media screen and (max-width: $device-mobile-max)
.banner.top .banner.top
border-radius: 0 border-radius: 0
.md-text.content .tag-plugin.banner:first-child .md-text.content:first-child .tag-plugin.banner:first-child
margin-top: 1rem margin-top: 1rem

View File

@ -82,7 +82,7 @@
.tab-content:has(.grid-box) .tab-content:has(.grid-box)
width: 100% width: 100%
.l_body[text-indent] .md-text .tag-plugin.tabs .tab-content p:not([class]) .l_body[text-indent] .md-text .tag-plugin.tabs .tab-content .tab-pane>p:not([class])
text-indent: 'calc(%s * 2)' % var(--fs-p) text-indent: 'calc(%s * 2)' % var(--fs-p)
a a
text-indent: 0 text-indent: 0