musicfree-themepack-dev
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMusicFree 桌面版主题包开发
MusicFree Desktop Theme Pack Development
核心认知
Core Concepts
MusicFree 主题包的本质是 CSS Custom Properties 覆盖层。
应用内置一套默认暗色主题(定义在 的 中,约 150+ CSS 变量),主题包通过 中的 选择性覆盖这些变量来实现换肤。未覆盖的变量自动继承默认暗色值。
global.scss:rootindex.css:root {}The essence of MusicFree theme packs is CSS Custom Properties override layer.
The application has a built-in default dark theme (defined in of , with more than 150 CSS variables). The theme pack selectively overrides these variables through in to implement skin replacement. Uncovered variables automatically inherit the default dark values.
:rootglobal.scss:root {}index.css行为准则
Code of Conduct
以下规则在整个主题开发过程中始终生效:
- 视觉产物无法预览:AI 无法看到主题的实际渲染效果,因此每一步重要决策都必须与用户确认,不要自行判断"好看"
- 先确认再动手:调色板、变量覆盖范围、背景风格等关键决策,必须描述清楚并获得用户同意后再生成代码
- 解释技术术语:用户可能是零基础社区贡献者,所有专业概念必须用通俗语言解释
- 最小覆盖原则:只覆盖需要改变的 CSS 变量,不要为了"完整性"覆盖所有变量
- 浅色主题例外:浅色主题必须覆盖全部 Background / Fill / Text / Border 类变量,否则会出现暗色残留
- 资源体积优先:图片必须压缩(推荐 WebP),避免不必要的大文件
The following rules are always effective throughout the theme development process:
- Visual products cannot be previewed: AI cannot see the actual rendering effect of the theme, so every important decision must be confirmed with the user, do not judge whether it is "good-looking" by yourself
- Confirm before implementation: Key decisions such as color palette, variable coverage range, and background style must be clearly described and approved by the user before generating code
- Explain technical terms: Users may be zero-based community contributors, all professional concepts must be explained in plain language
- Minimum coverage principle: Only cover CSS variables that need to be changed, do not cover all variables for the sake of "completeness"
- Light theme exception: Light themes must cover all Background / Fill / Text / Border variables, otherwise dark color residues will appear
- Resource volume priority: Images must be compressed (WebP is recommended), avoid unnecessary large files
角色与协作模式
Roles and Collaboration Mode
- AI(你):提供色彩方案建议、编写 CSS/HTML 代码、生成 config.json、打包主题
- 用户:提供创意方向、选择方案、安装测试主题、提供视觉反馈
- AI (you): Provide color scheme suggestions, write CSS/HTML code, generate config.json, package the theme
- User: Provide creative direction, select solutions, install and test the theme, provide visual feedback
与 plugin-dev 的区别
Difference from plugin-dev
主题包是视觉产物,不像插件可以通过测试脚本验证正确性。因此本 Skill 采用 "AI 建议 → 用户判断 → 迭代微调" 的循环模式,而非 plugin-dev 的 "AI 主导" 模式。预期需要 2-3 轮迭代。
Theme packs are visual products, unlike plugins that can verify correctness through test scripts. Therefore, this Skill adopts the cyclic mode of "AI suggestion → user judgment → iterative fine-tuning", instead of the "AI-led" mode of plugin-dev. 2-3 rounds of iteration are expected.
与用户交互原则
User Interaction Principles
- 每次提供 2-3 个方案选项,让用户选择或混合
- 描述色彩时同时给出色值和直观描述(如 "rgb(52, 211, 153) — 翡翠绿,类似 Spotify 的绿色")
- 需要用户操作时,给出精确的逐步指令
- 不确定用户意图时,先问再做
- Provide 2-3 solution options each time for users to choose or mix
- Describe colors with both color values and intuitive descriptions (e.g. "rgb(52, 211, 153) — emerald green, similar to Spotify's green")
- Provide precise step-by-step instructions when user operation is required
- Ask first before acting when you are unsure of the user's intention
工作流程
Workflow
1. 需求采集 → 2. 风格定调 → 3. 调色板生成 → 4. CSS 变量映射
→ 5. 增强层(可选) → 6. 打包与测试 → 7. 迭代优化
→ 8.(可选)提交到主题市场1. Demand Collection → 2. Style Determination → 3. Palette Generation → 4. CSS Variable Mapping
→ 5. Enhancement Layer (Optional) → 6. Packaging and Testing → 7. Iterative Optimization
→ 8. (Optional) Submit to Theme Market阶段 1:需求采集
Phase 1: Demand Collection
收集以下信息(一次问全,不要分多轮零碎地问):
必须收集:
- 主题名称
- 基本方向:暗色 / 浅色 / AMOLED 纯黑 / 其他
- 用户的创意意图(以下任一形式均可):
- 情绪/氛围关键词(如"温暖的""赛博朋克""清新自然")
- 参考色值(如"我想要粉色系")
- 参考应用/网站(如"类似 Spotify 的深绿")
- 参考图片(用户直接贴图)
- 完全自定义的详细描述
可选收集:
- 作者名
- 描述
- 是否需要动态 iframe 背景
- 是否有自定义图片素材(如背景图、预览图)
Collect the following information (ask all at once, do not ask in multiple fragmented rounds):
Must collect:
- Theme name
- Basic direction: Dark / Light / AMOLED pure black / Other
- User's creative intention (any of the following forms is acceptable):
- Emotion/atmosphere keywords (e.g. "warm", "cyberpunk", "fresh and natural")
- Reference color values (e.g. "I want pink series")
- Reference application/website (e.g. "Similar to Spotify's dark green")
- Reference image (users post images directly)
- Fully customized detailed description
Optional collection:
- Author name
- Description
- Whether dynamic iframe background is required
- Whether there are custom image materials (e.g. background image, preview image)
阶段 2:风格定调
Phase 2: Style Determination
基于用户输入,提供 2-3 个风格方向的文字描述(此阶段不写代码)。
每个方向包含:
- 品牌色色值 + 直观描述
- 明暗基调
- 氛围关键词
- 背景风格(纯色 / 渐变 / 图片 / 动态)
用户选择一个方向,或从多个方向中混合元素。
如果用户已经非常明确 — 比如直接给了色值、给了完整描述,可以跳过此阶段直接进入阶段 3。
Based on user input, provide 2-3 style directions in text description (no code writing at this stage).
Each direction includes:
- Brand color value + intuitive description
- Light and dark tone
- Atmosphere keywords
- Background style (solid color / gradient / image / dynamic)
The user chooses one direction, or mixes elements from multiple directions.
If the user is already very clear — for example, directly gave the color value, gave a complete description, you can skip this phase and go directly to Phase 3.
阶段 3:调色板生成
Phase 3: Palette Generation
根据选定方向,推导完整调色板。参考 references/color-paradigms.md 中的色彩范式。
向用户展示推导结果,按类别分组:
- 品牌色(brand)
- 背景色层级(base → sidebar → player → surface → ...)
- 文本色层级(primary → secondary → muted → ...)
- 边框色层级
- 状态色(如果需要自定义)
等待用户确认后进入下一阶段。
Derive the complete palette according to the selected direction. Refer to the color paradigm in references/color-paradigms.md.
Show the derivation results to the user, grouped by category:
- Brand color (brand)
- Background color hierarchy (base → sidebar → player → surface → ...)
- Text color hierarchy (primary → secondary → muted → ...)
- Border color hierarchy
- Status color (if customization is required)
Wait for user confirmation before entering the next phase.
阶段 4:CSS 变量映射
Phase 4: CSS Variable Mapping
将确认的调色板映射到 MusicFree 的语义 CSS 变量。
参考 references/css-variable-reference.md 获取完整变量清单和覆盖规则。
变量覆盖的三级分类:
| 分类 | 说明 |
|---|---|
| 必须覆盖 | 定义主题核心视觉身份的变量,不覆盖等于没换肤 |
| 建议覆盖 | 覆盖后主题才完整;浅色主题如果不覆盖会出现暗色残留 |
| 禁止覆盖 | 结构性 token(z-index / typography / spacing / layout / control sizes / icon sizes / motion),改了会破坏布局或功能 |
特殊分类:
- Shadow / Blur:风格性 token。扁平化/AMOLED 主题可设为 ;玻璃态主题可增大 blur 值
none - Radius:默认不覆盖。仅当用户明确要求极端风格时(如纯棱角赛博朋克)才可调整,需告知用户可能导致部分组件视觉异常
- Background Image ():属于增强层,根据主题风格决定是否覆盖
--bg-image
生成 文件,格式参照内置主题:
index.csscss
/*
* 主题名称
*/
:root {
/* ── Background ── */
--color-bg-base: ...;
/* ... */
/* ── Fill ── */
--color-fill-brand: ...;
/* ... */
}Map the confirmed palette to MusicFree's semantic CSS variables.
Refer to references/css-variable-reference.md for the complete variable list and override rules.
Three-level classification of variable coverage:
| Category | Description |
|---|---|
| Must Cover | Variables that define the core visual identity of the theme, no coverage means no skin replacement |
| Recommended to Cover | The theme is complete after coverage; light themes will have dark residues if not covered |
| Prohibited to Cover | Structural tokens (z-index / typography / spacing / layout / control sizes / icon sizes / motion), modification will damage the layout or function |
Special Categories:
- Shadow / Blur: Stylish tokens. Flat/AMOLED themes can be set to ; glass morphism themes can increase the blur value
none - Radius: Not covered by default. It can be adjusted only when the user explicitly requires extreme styles (e.g. pure angular cyberpunk), and the user should be informed that it may cause visual abnormalities of some components
- Background Image (): Belongs to the enhancement layer, decide whether to cover according to the theme style
--bg-image
Generate file, the format refers to the built-in theme:
index.csscss
/*
* Theme Name
*/
:root {
/* ── Background ── */
--color-bg-base: ...;
/* ... */
/* ── Fill ── */
--color-fill-brand: ...;
/* ... */
}阶段 5:增强层(可选)
Phase 5: Enhancement Layer (Optional)
根据主题风格,可选择性地添加增强效果:
5a. 背景渐变()
--bg-image使用 CSS / 组合。推荐使用 引用品牌色,避免硬编码。
radial-gradientlinear-gradientcolor-mix(in srgb, var(--color-fill-brand) X%, transparent)5b. 阴影风格调整
- 柔阴影(默认):保持默认值
- 硬阴影:减小 blur-radius,增大 spread
- 无阴影(AMOLED/扁平化):全部设为
none
5c. 自定义图片资源
如果用户提供了背景图/预览图等素材:
- 引导压缩图片(推荐 WebP 格式)
- 单张图片 ≤ 500 KB
- 在 CSS 中通过 路径引用(如
@/)url(@/imgs/bg.webp) - 是路径别名,运行时会被替换为主题包目录的绝对路径
@/
5d. iframe 动态背景
详见 references/iframe-guide.md。
适合场景:粒子效果、动态渐变动画等。
需要额外准备:
- :动态背景入口文件
iframes/app.html - config.json 中添加
"iframe": { "app": "@/iframes/app.html" } - 建议提供 字段作为加载占位符(可选但推荐)
blurHash
According to the theme style, you can selectively add enhancement effects:
5a. Background Gradient ()
--bg-imageUse CSS / combination. It is recommended to use to reference the brand color to avoid hard coding.
radial-gradientlinear-gradientcolor-mix(in srgb, var(--color-fill-brand) X%, transparent)5b. Shadow Style Adjustment
- Soft shadow (default): Keep the default value
- Hard shadow: Reduce blur-radius, increase spread
- No shadow (AMOLED/flat): All set to
none
5c. Custom Image Resources
If the user provides materials such as background images/preview images:
- Guide to compress images (WebP format is recommended)
- Single image ≤ 500 KB
- Reference through path in CSS (e.g.
@/)url(@/imgs/bg.webp) - is a path alias, which will be replaced with the absolute path of the theme pack directory at runtime
@/
5d. iframe Dynamic Background
See references/iframe-guide.md for details.
Suitable scenarios: particle effects, dynamic gradient animation, etc.
Additional preparation required:
- : Dynamic background entry file
iframes/app.html - Add in config.json
"iframe": { "app": "@/iframes/app.html" } - It is recommended to provide field as a loading placeholder (optional but recommended)
blurHash
阶段 6:打包与测试
Phase 6: Packaging and Testing
详见 references/packaging-checklist.md。
步骤概览:
- 确认文件结构完整
- 生成
config.json - 检查资源体积
- 打包为 (ZIP 格式,改扩展名)
.mftheme - 指导用户安装测试
安装测试指引(告诉用户):
- 打开 MusicFree 桌面版
- 进入「主题」页面
- 点击「安装主题包」按钮
- 选择生成的 文件
.mftheme - 点击主题卡片应用
- 检查各页面是否正常显示
See references/packaging-checklist.md for details.
Step Overview:
- Confirm the file structure is complete
- Generate
config.json - Check resource volume
- Package as (ZIP format, change the extension)
.mftheme - Guide users to install and test
Installation Test Guide (tell the user):
- Open MusicFree desktop version
- Enter the「Themes」page
- Click the「Install Theme Pack」button
- Select the generated file
.mftheme - Click the theme card to apply
- Check whether each page is displayed normally
阶段 7:迭代优化
Phase 7: Iterative Optimization
根据用户测试反馈进行微调。常见反馈和对应处理:
| 用户反馈 | 可能原因 | 调整方向 |
|---|---|---|
| "某个区域看不清文字" | 文本色与背景色对比度不足 | 增大文本色与背景色的亮度差 |
| "按钮看不清" | 品牌填充色与 on-brand 文本色对比不足 | 调整 |
| "侧边栏太暗/太亮" | | 调整该变量的亮度或透明度 |
| "整体太刺眼" | 浅色主题背景过白或品牌色过饱和 | 降低背景亮度或品牌色饱和度 |
| "弹窗不明显" | overlay/modal 背景色与主背景区分度不够 | 调整 |
| "选中状态看不出来" | brand-muted 与 surface 太接近 | 增大 |
每次修改后重新打包,让用户重新安装测试。
Fine-tune according to user test feedback. Common feedback and corresponding processing:
| User Feedback | Possible Cause | Adjustment Direction |
|---|---|---|
| "The text in a certain area is unclear" | Insufficient contrast between text color and background color | Increase the brightness difference between text color and background color |
| "The button is unclear" | Insufficient contrast between brand fill color and on-brand text color | Adjust |
| "The sidebar is too dark/too bright" | | Adjust the brightness or transparency of this variable |
| "The whole is too dazzling" | The light theme background is too white or the brand color is too saturated | Reduce the background brightness or brand color saturation |
| "The pop-up window is not obvious" | The distinction between overlay/modal background color and main background is not enough | Adjust the transparency of |
| "The selected state cannot be seen" | brand-muted is too close to surface | Increase the transparency of |
Repackage after each modification, let the user reinstall and test.
阶段 8(可选):提交到主题市场
Phase 8 (Optional): Submit to Theme Market
如果用户希望将主题发布到 MusicFree 主题市场:
- Fork 仓库:引导用户 Fork MusicFreeThemePacks
- 切换分支:基于 分支创建开发分支
v1/source - 创建文件夹:在 下创建主题文件夹
themes/- 命名规则:仅允许字母、数字、连字符()、下划线(
-)_
- 命名规则:仅允许字母、数字、连字符(
- 补充 tags:在 config.json 中添加 字段(1-5 个标签,从预定义列表选取)
tags- 不要在 config.json 中添加 字段(ID 由系统自动管理)
id - 动态主题必须包含 标签
"动态"
- 不要在 config.json 中添加
- 本地校验:
bash
npm install npm run validate:theme your-theme-name - 提交 PR:向 分支提交 Pull Request
v1/source
预定义标签列表:
| key | label | 说明 |
|---|---|---|
| 暗色 | 深色/暗黑系 |
| 亮色 | 浅色/明亮系 |
| 渐变 | 渐变色背景 |
| 简约 | 简洁风格 |
| 动漫 | 动漫/二次元风格 |
| 风景 | 自然风景背景 |
| 插画 | 插画风格背景 |
| 赛博 | 赛博朋克/科技感 |
| 像素 | 像素风格 |
| 抽象 | 抽象艺术风格 |
| 动态 | 包含动画效果(有 iframe 必加) |
| 可爱 | 可爱/萌系风格 |
| 游戏 | 游戏相关 |
| 影视 | 电影/动画电影相关 |
| 季节 | 与季节相关 |
| 自然 | 花、樱花、星空等自然元素 |
If the user wants to publish the theme to the MusicFree theme market:
- Fork the repository: Guide the user to Fork MusicFreeThemePacks
- Switch branches: Create a development branch based on the branch
v1/source - Create a folder: Create a theme folder under
themes/- Naming rules: Only letters, numbers, hyphens (), and underscores (
-) are allowed_
- Naming rules: Only letters, numbers, hyphens (
- Add tags: Add field in config.json (1-5 tags, selected from the predefined list)
tags- Do not add the field in config.json (ID is automatically managed by the system)
id - Dynamic themes must include the tag
"动态"
- Do not add the
- Local verification:
bash
npm install npm run validate:theme your-theme-name - Submit PR: Submit a Pull Request to the branch
v1/source
Predefined Tag List:
| key | label | Description |
|---|---|---|
| 暗色 | Dark color / dark style |
| 亮色 | Light color / bright style |
| 渐变 | Gradient background |
| 简约 | Simple style |
| 动漫 | Anime / two-dimensional style |
| 风景 | Natural landscape background |
| 插画 | Illustration style background |
| 赛博 | Cyberpunk / sense of technology |
| 像素 | Pixel style |
| 抽象 | Abstract art style |
| 动态 | Contains animation effects (must be added if there is an iframe) |
| 可爱 | Cute / moe style |
| 游戏 | Game related |
| 影视 | Movie / animated movie related |
| 季节 | Season related |
| 自然 | Natural elements such as flowers, cherry blossoms, starry sky, etc. |
主题包文件结构
Theme Pack File Structure
my-theme/
├── config.json # 必须 — 主题元信息
├── index.css # 必须 — CSS 变量覆盖
├── imgs/ # 可选 — 图片资源
│ ├── preview.webp # 预览图(推荐 WebP)
│ └── ...
└── iframes/ # 仅动态主题需要
├── app.html # 动态背景入口
└── ...my-theme/
├── config.json # Required — Theme meta information
├── index.css # Required — CSS variable override
├── imgs/ # Optional — Image resources
│ ├── preview.webp # Preview image (WebP recommended)
│ └── ...
└── iframes/ # Only required for dynamic themes
├── app.html # Dynamic background entry
└── ...config.json 字段说明
config.json Field Description
jsonc
{
"name": "主题名称", // 必须
"preview": "@/imgs/preview.webp", // 推荐 — 图片路径或 "#hex" 色值
"description": "主题描述", // 推荐
"author": "作者", // 推荐
"authorUrl": "https://...", // 可选
"version": "0.0.1", // 推荐 — 更新时必须递增
"tags": ["暗色"], // 提交到主题市场时需要,1-5 个
"blurHash": "...", // 有 iframe 时推荐(加载占位)
"iframe": { // 仅动态主题
"app": "@/iframes/app.html"
}
}注意:
- 可以是图片路径(如
preview)或 CSS 颜色值(如@/imgs/preview.webp)"#1a1a2e" - 在本地开发阶段可省略,提交到主题市场时再补充
tags - 字段不要手动添加,由主题市场系统自动管理
id
jsonc
{
"name": "Theme Name", // Required
"preview": "@/imgs/preview.webp", // Recommended — Image path or "#hex" color value
"description": "Theme Description", // Recommended
"author": "Author", // Recommended
"authorUrl": "https://...", // Optional
"version": "0.0.1", // Recommended — Must be incremented when updating
"tags": ["暗色"], // Required when submitting to the theme market, 1-5
"blurHash": "...", // Recommended when there is an iframe (loading placeholder)
"iframe": { // Only for dynamic themes
"app": "@/iframes/app.html"
}
}Note:
- can be an image path (e.g.
preview) or a CSS color value (e.g.@/imgs/preview.webp)"#1a1a2e" - can be omitted in the local development phase, and supplemented when submitting to the theme market
tags - Do not add the field manually, it is automatically managed by the theme market system
id
@/
路径别名
@/@/
Path Alias
@/CSS 和 config.json 中的 是路径别名,指向主题包根目录。运行时会被替换为 绝对路径。
@/file://例如:
- →
@/imgs/bg.webpfile:///C:/Users/.../themes/my-theme/imgs/bg.webp - 可在 CSS 中引用本地图片
url(@/imgs/texture.png)
@/file://For example:
- →
@/imgs/bg.webpfile:///C:/Users/.../themes/my-theme/imgs/bg.webp - can reference local images in CSS
url(@/imgs/texture.png)
资源限制
Resource Limits
| 约束项 | 限制 |
|---|---|
| 单张图片 | ≤ 500 KB |
| 单个视频 | ≤ 5 MB |
| 整个主题包 | ≤ 10 MB |
优化建议:
- 优先使用 WebP 格式(比 PNG/JPG 体积小 25-35%)
- 用 TinyPNG 等工具压缩图片
- 优先使用 CSS 渐变替代图片纹理
- 视频尽量使用较低分辨率或帧率
| Constraint Item | Limit |
|---|---|
| Single image | ≤ 500 KB |
| Single video | ≤ 5 MB |
| Entire theme pack | ≤ 10 MB |
Optimization Suggestions:
- Prioritize using WebP format (25-35% smaller than PNG/JPG)
- Compress images with tools such as TinyPNG
- Prioritize using CSS gradients instead of image textures
- Try to use lower resolution or frame rate for videos