refactor(achievement): 稀有度配色收进 constants,文字色适配浅色模式
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled

四份重复的 RARITY_COLOR / RARITY_LABEL 合并到 utils/constants。
拆成两套:边框色块继续用饱和的原色,文字改走 useRarityColor,
按明暗主题切换,两套都压到 4.5:1 以上——原色是照深色底调的,
白底上白金只有 1.7:1、黄金 2.2:1,卡片上的稀有度 tag 看不清。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-05 11:24:04 -06:00
parent 4db0dc7e83
commit 0d7336bce8
7 changed files with 69 additions and 59 deletions

View File

@@ -1,4 +1,4 @@
import type { SUBMISSION_RESULT } from "./types"
import type { AchievementRarity, SUBMISSION_RESULT } from "./types"
export enum SubmissionStatus {
compile_error = -2,
@@ -276,6 +276,42 @@ export enum ChartType {
Activity,
}
// 成就稀有度
export const RARITY_LABEL: Record<AchievementRarity, string> = {
bronze: "青铜",
silver: "白银",
gold: "黄金",
platinum: "白金",
}
// 边框、色块用的原色:饱和度够高,明暗底上都醒目
export const RARITY_COLOR: Record<AchievementRarity, string> = {
bronze: "#b87333",
silver: "#9fa6b2",
gold: "#e0a300",
platinum: "#7dd3fc",
}
// 文字要另配一套。上面那组是照深色底调的,搬到白底上白金只有 1.7:1、
// 黄金 2.2:112px 的稀有度标签根本看不清。取色见 useRarityColor
export const RARITY_TEXT_COLOR: Record<
"dark" | "light",
Record<AchievementRarity, string>
> = {
dark: {
bronze: "#d18d4f",
silver: "#b6bcc7",
gold: "#e0a300",
platinum: "#7dd3fc",
},
light: {
bronze: "#9a5b25",
silver: "#6b7280",
gold: "#a37500",
platinum: "#0284c7",
},
}
// 时间范围配置
export const DURATION_OPTIONS = [
{ label: "本节课内", value: "hours:1" },