From 1fa700d8db1252ca46168f7cda24541701729e34 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Thu, 8 Feb 2024 00:03:15 +0800 Subject: [PATCH] [opt] icon --- scripts/tags/lib/icon.js | 15 ++++++++++----- source/css/_layout/tag-plugins/common.styl | 4 ++++ source/css/_layout/tag-plugins/icon.styl | 6 ++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/scripts/tags/lib/icon.js b/scripts/tags/lib/icon.js index a0a7d9e..d5bd7a1 100644 --- a/scripts/tags/lib/icon.js +++ b/scripts/tags/lib/icon.js @@ -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 += '` + } + el += `` var more = '' if (args.style) { more += `style="${args.style}"` } el += ctx.utils.icon(args.key, more) - el += '' + el += `` + if (args.text) { + el += `${args.text}` + el += '' + } return el } diff --git a/source/css/_layout/tag-plugins/common.styl b/source/css/_layout/tag-plugins/common.styl index a9bba67..e82869d 100644 --- a/source/css/_layout/tag-plugins/common.styl +++ b/source/css/_layout/tag-plugins/common.styl @@ -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'] diff --git a/source/css/_layout/tag-plugins/icon.styl b/source/css/_layout/tag-plugins/icon.styl index 1badf48..a1c262a 100644 --- a/source/css/_layout/tag-plugins/icon.styl +++ b/source/css/_layout/tag-plugins/icon.styl @@ -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 \ No newline at end of file