[opt] icon

This commit is contained in:
xaoxuu 2024-02-08 00:03:15 +08:00
parent e7ea88944d
commit 1fa700d8db
3 changed files with 20 additions and 5 deletions

View File

@ -9,19 +9,24 @@
'use strict' 'use strict'
module.exports = ctx => function(args) { module.exports = ctx => function(args) {
args = ctx.args.map(args, ['color', 'style'], ['key']) args = ctx.args.map(args, ['color', 'style'], ['key', 'text'])
if (args.color == null) { if (args.color == null) {
args.color = ctx.theme.config.tag_plugins.icon.default_color args.color = ctx.theme.config.tag_plugins.icon.default_color
} }
var el = '' var el = ''
el += '<span class="tag-plugin colorful icon"' if (args.text) {
el += ' ' + ctx.args.joinTags(args, ['color']).join(' ') el += `<div class="tag-plugin icon-wrap">`
el += '>' }
el += `<span class="tag-plugin icon colorful" ${ctx.args.joinTags(args, ['color']).join(' ')}>`
var more = '' var more = ''
if (args.style) { if (args.style) {
more += `style="${args.style}"` more += `style="${args.style}"`
} }
el += ctx.utils.icon(args.key, more) el += ctx.utils.icon(args.key, more)
el += '</span>' el += `</span>`
if (args.text) {
el += `<span class="text">${args.text}</span>`
el += '</div>'
}
return el return el
} }

View File

@ -30,6 +30,8 @@ set_dynamic_color($theme)
set_dynamic_color($c-red) set_dynamic_color($c-red)
.colorful[color='orange'] .colorful[color='orange']
set_dynamic_color($c-orange) set_dynamic_color($c-orange)
.colorful[color='amber']
set_dynamic_color($c-amber)
.colorful[color='yellow'] .colorful[color='yellow']
set_dynamic_color($c-yellow) set_dynamic_color($c-yellow)
.colorful[color='green'] .colorful[color='green']
@ -81,6 +83,8 @@ _dark_tags()
set_dynamic_color($c-red) set_dynamic_color($c-red)
.colorful[color='orange'] .colorful[color='orange']
set_dynamic_color($c-orange) set_dynamic_color($c-orange)
.colorful[color='amber']
set_dynamic_color($c-amber)
.colorful[color='yellow'] .colorful[color='yellow']
set_dynamic_color($c-yellow) set_dynamic_color($c-yellow)
.colorful[color='green'] .colorful[color='green']

View File

@ -10,3 +10,9 @@ span.tag-plugin.icon
color: var(--theme) color: var(--theme)
img img
object-fit: contain object-fit: contain
p>strong>span.tag-plugin.icon
margin: -4px 4px 0 0
.tag-plugin.icon-wrap span.tag-plugin.icon
margin-right: 4px