[opt] wiki tag
This commit is contained in:
parent
b717668ab3
commit
2d4f203b43
|
@ -1,9 +1,22 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
hexo.extend.helper.register('category_color', function(cat){
|
hexo.extend.helper.register('category_color', function(cat){
|
||||||
const cfg = hexo.theme.config;
|
const { config } = hexo.theme
|
||||||
if (cfg.article.category_color && cfg.article.category_color[cat]) {
|
const color = config.article.category_color[cat]
|
||||||
return ' style="color:' + cfg.article.category_color[cat] + '"';
|
if (color) {
|
||||||
|
var textColor = color
|
||||||
|
if (color.startsWith('#')) {
|
||||||
|
textColor = color
|
||||||
|
} else {
|
||||||
|
textColor = '#' + color
|
||||||
|
}
|
||||||
|
var bgColor = textColor
|
||||||
|
if (textColor.length == (1+3)) { // #fff
|
||||||
|
bgColor += '2'
|
||||||
|
} else if (textColor.length == (1+6)) { // #ffffff
|
||||||
|
bgColor += '20'
|
||||||
|
}
|
||||||
|
return ` style="--text-p3:${textColor};--theme-block:${bgColor}"`;
|
||||||
}
|
}
|
||||||
return '';
|
return ''
|
||||||
});
|
})
|
||||||
|
|
|
@ -162,6 +162,10 @@
|
||||||
flex: 1
|
flex: 1
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
word-wrap: break-word
|
word-wrap: break-word
|
||||||
|
.cap
|
||||||
|
background: var(--theme-block)
|
||||||
|
padding: 2px 4px
|
||||||
|
border-radius: 2px
|
||||||
p:last-child
|
p:last-child
|
||||||
margin-bottom: 0
|
margin-bottom: 0
|
||||||
.cap+.cap
|
.cap+.cap
|
||||||
|
|
Loading…
Reference in New Issue