From d58c9c0c92b93917df2c35f52d9eff1659d21069 Mon Sep 17 00:00:00 2001 From: klarkxy <278370456@qq.com> Date: Thu, 1 May 2025 16:36:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99=E6=89=80=E6=9C=89tag=E4=B8=8A?= =?UTF-8?q?=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/template/syzoj/category.php | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/web/template/syzoj/category.php b/web/template/syzoj/category.php index 747c9d4..7f0b9e3 100644 --- a/web/template/syzoj/category.php +++ b/web/template/syzoj/category.php @@ -19,14 +19,32 @@ ]; // 生成标签地图 + // 定义颜色主题数组 + $color_theme = array("primary", "secondary", "positive", "negative", "orange", "yellow", "olive", "green", "teal", "blue", "violet", "purple", "pink", "brown", "grey", "black"); + + // 为标签添加颜色样式 + function colorize_tag($tag) { + global $color_theme; + $hash_num = hexdec(substr(md5($tag), 0, 7)); + $label_theme = $color_theme[$hash_num % count($color_theme)]; + + if ($label_theme == "") + $label_theme = "default"; + + return $label_theme; + } + foreach ($tag_map as $level => $tags): ?> -