[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'
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) {
args.color = ctx.theme.config.tag_plugins.icon.default_color
}
var el = ''
el += '<span class="tag-plugin colorful icon"'
el += ' ' + ctx.args.joinTags(args, ['color']).join(' ')
el += '>'
if (args.text) {
el += `<div class="tag-plugin icon-wrap">`
}
el += `<span class="tag-plugin icon colorful" ${ctx.args.joinTags(args, ['color']).join(' ')}>`
var more = ''
if (args.style) {
more += `style="${args.style}"`
}
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
}

View File

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

View File

@ -10,3 +10,9 @@ span.tag-plugin.icon
color: var(--theme)
img
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