theme-variables

Guidance on correctly using Ant Design and custom theme CSS variables in front-end projects, aimed at avoiding hard-coded colors and ensuring consistent styling when switching dark/light themes. Intended for front-end developers to consult when writing or modifying styles.

Last repository push
GitHub Stars
109
Forks
35
Issues / PRs
0

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "theme-variables" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-ba8a5fdf44e73376bbac621e81631a19b29235ea90f09a817a28a6f267b6bd39. Verify the upstream source and version against https://github.com/AntonHu/ai-coding-project before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Guidance on correctly using Ant Design and custom theme CSS variables in front-end projects, aimed at avoiding hard-coded colors and ensuring consistent styling when switching dark/light themes. Intended for front-end developers to consult when writing or modifying styles.

0 Downloads

Introduction source: third_party · AntonHu · 0.0.1 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Audience
Translation pending; see source documentation.
Inputs and outputs
Not specified in the source documentation.
Software, accounts and paid services
Not specified in the source documentation.
Limits and differences
Not specified in the source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: theme-variables
description: 指导在前端项目中正确使用 Ant Design 与自定义主题 CSS 变量,避免硬编码颜色并保证暗色/浅色主题切换一致性。当前端编写或修改样式时使用本技能。

主题 CSS 变量与样式规范

使用场景

当你在:

  • 为组件/页面编写新的样式
  • 修改已有样式以适配暗色/浅色主题

请使用本技能,并同时遵守 .agents/rules/04-组件规范.md 与 .agents/rules/08-样式规范.md。


基本原则

  • 所有自定义样式必须使用 CSS 变量 表达主题相关的颜色与尺寸。
  • 禁止硬编码主色、文本色、背景色等与主题相关的属性。

常用 Ant Design 主题变量

在 SCSS 中直接使用:

color: var(--ant-color-text);
background-color: var(--ant-color-bg-container);
border-color: var(--ant-color-border);

常见变量举例:

  • 主色:var(--ant-color-primary)
  • 文本色:var(--ant-color-text)
  • 容器背景:var(--ant-color-bg-container)
  • 边框色:var(--ant-color-border)

自定义主题变量示例

项目中可以定义自有变量,例如:

  • var(--shentu-card-bg)
  • var(--shentu-border-radius)
  • var(--shentu-cn-family)

在组件样式中的使用:

.card {
  background-color: var(--shentu-card-bg);
  border-radius: var(--shentu-border-radius);
  font-family: var(--shentu-cn-family);
}

反例(不要这样写)

// ❌ 硬编码颜色,不随主题变化
.button {
  background-color: #1677ff;
  color: #ffffff;
}

快速检查清单

  • [ ] 所有颜色是否都来自 var(--xxx) 变量?
  • [ ] 是否优先使用 Antd 自带变量,其次再用自定义变量?
  • [ ] 是否避免在组件/页面样式中写死颜色值?

Current listing version

0.0.1

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value75/100

Highlights

  • 提供前端项目中 Ant Design 与自定义主题 CSS 变量的使用规范
  • 指导避免硬编码颜色并保证暗色/浅色主题切换一致性
  • 属于明确场景的通用工具,具有广泛受众的实用能力
Trigger Precision85/100

Highlights

  • description 明确指出“当前端编写或修改样式时使用本技能”
  • 在 skill_body 中进一步细化“为组件/页面编写新的样式”和“修改已有样式以适配暗色/浅色主题”
  • 触发词覆盖合理,边界清晰
Structure and Standards90/100

Highlights

  • 文档结构清晰,包含基本原则、常用变量、自定义变量示例、反例和快速检查清单
  • 有明确的步骤划分和示例
  • frontmatter 完整
Execution Reliability85/100

Highlights

  • 提供了具体的 CSS 变量使用示例和反例
  • 工具来源明确(Ant Design),参数正确
  • 覆盖了主要异常(硬编码颜色)
Evidence Verifiability (mean of the first four)84/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Not specified in the source documentation.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.