[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%)' # 超链接颜色
button: 'hsl(192 98% 55%)' # 按钮颜色
hover: 'hsl(14 100% 57%)' # 按钮高亮颜色
link:
underline: true # true / false
animated_avatar:
animate: auto # auto, always
background: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/avatar/round/rainbow64@3x.webp

View File

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

View File

@ -9,7 +9,7 @@ function layoutDiv() {
// 2.left
el += `<div class="left">`
// 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>`
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
}
%>

View File

@ -2,19 +2,24 @@
function layoutDiv() {
// 作者
var el = ''
el += `<div id="post-meta">`
el += `<div class="flex-row" id="post-meta">`
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 += `</span>`
} 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 += `</span>`
// 更新日期
el += `<span class="updated">`
el += `<span class="dot"></span>`
el += `<span class="sep updated"></span>`
el += `<span class="text updated">`
el += `${__("meta.updated") + __("symbol.colon")}`
el += `<time datetime="${date_xml(page.updated)}">${date(page.updated, config.date_format)}</time>`
el += `</span>`

View File

@ -116,35 +116,13 @@
.md-text
p:not([class]), li:not([class])
a:not([class])
position: relative
padding: 2px 0
text-decoration: none
line-height: 1.2
&:before
content: ''
position: absolute
padding: 0 2px
margin: 0 -2px
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
trans1 all
text-decoration: underline
&:hover
border-bottom: none
color: var(--theme-link)
z-index 0
&:before
height: 100%
opacity: 0.2
z-index -1
bottom: 0
left: -2px
right: -2px
color: $color-hover
&:has(img)
&:before
content: none
text-decoration: none
padding: 0

View File

@ -1,6 +1,6 @@
.article.banner
--text-banner: var(--text-p0)
--hover-bg: rgba(black, 0.08)
--button-hover-bg: rgba(black, 0.08)
background: var(--block)
margin: 0
height: unset
@ -8,7 +8,7 @@
.article.banner
.bg+.content
--text-banner: white
--hover-bg: rgba(white, 0.2)
--button-hover-bg: rgba(white, 0.2)
background: rgba(black, 0.1)
.article.banner .content
@ -18,6 +18,29 @@
.title
font-size: $fs-h1
color: var(--text-banner)
.bottom
padding: 1.5rem 1rem
h1
line-height: 1.2
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
display: flex
justify-content: space-between
div#breadcrumb
color: var(--text-banner)
.flex-row
display: flex
align-items: baseline
flex-direction: row
@ -11,20 +12,19 @@
color: var(--text-banner)
padding: 4px
border-radius: 2px
&:hover
background: var(--button-hover-bg)
span
color: var(--text-banner)
span.sep
opacity 0.5
margin: 0
span.dot:before
opacity 0.5
margin: 0 8px
a:hover
background: var(--hover-bg)
div#post-meta
span.text
padding: 4px
color: var(--text-banner)
div#post-meta
span.sep:before
content: '|'
span.updated
visibility: hidden
&:hover

View File

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

View File

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

View File

@ -82,7 +82,7 @@
.tab-content:has(.grid-box)
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)
a
text-indent: 0