theme-foundation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTheme Foundation
主题基础
Generate a complete theme color system from a single brand color. Creates primary accent, secondary accent (complementary), and neutral ramps - all mathematically derived.
从单一品牌色生成完整的主题颜色系统。通过数学推导生成主强调色、次要强调色(互补色)和中性色阶。
When to Use
适用场景
- "Create a theme from my brand color"
- "I need colors for light and dark mode"
- "Generate a color system for my app"
- "Start a new design system with this color"
- "用我的品牌色创建主题"
- "我需要适配明暗模式的颜色"
- "为我的应用生成颜色系统"
- "用这个颜色启动新的设计系统"
Installation
安装
bash
npx @basiclines/rampabash
npx @basiclines/rampaRecipe
使用方案
Given a user's brand color, generate three ramp types:
给定用户的品牌色,生成三种色阶类型:
1. Primary Accent Ramp
1. 主强调色色阶
The main brand color expanded to a full 10-shade scale.
bash
rampa -C "<brand-color>" -L 95:10 --size=10 -O css --name=accent将主品牌色扩展为完整的10级色阶。
bash
rampa -C "<brand-color>" -L 95:10 --size=10 -O css --name=accent2. Secondary Accent (Complementary)
2. 次要强调色(互补色)
Mathematically opposite on the color wheel - perfect for CTAs, highlights, or secondary actions.
bash
rampa -C "<brand-color>" --add=complementary -L 95:10 --size=10 -O cssThis outputs two ramps:
- - the primary accent
base - - the secondary accent
complementary-1
在色轮上的数学互补色——非常适合用于CTA、高亮或次要操作。
bash
rampa -C "<brand-color>" --add=complementary -L 95:10 --size=10 -O css此命令输出两个色阶:
- - 主强调色
base - - 次要强调色
complementary-1
3. Neutral Ramp
3. 中性色色阶
Derived from the brand color but heavily desaturated. This creates "warm" or "cool" neutrals that feel cohesive with the brand.
bash
rampa -C "<brand-color>" -L 98:5 -S 5:10 --size=10 -O css --name=neutral从品牌色衍生而来但饱和度极低。生成的“暖调”或“冷调”中性色会与品牌色保持协调。
bash
rampa -C "<brand-color>" -L 98:5 -S 5:10 --size=10 -O css --name=neutralComplete Example
完整示例
For brand color (blue):
#3b82f6bash
undefined对于品牌色 (蓝色):
#3b82f6bash
undefinedPrimary accent
主强调色
rampa -C "#3b82f6" -L 95:10 --size=10 -O css --name=accent
rampa -C "#3b82f6" -L 95:10 --size=10 -O css --name=accent
Secondary + Primary together
同时生成次要色和主色
rampa -C "#3b82f6" --add=complementary -L 95:10 --size=10 -O css
rampa -C "#3b82f6" --add=complementary -L 95:10 --size=10 -O css
Neutrals (slightly warm from the blue)
中性色(从蓝色衍生出轻微暖调)
rampa -C "#3b82f6" -L 98:5 -S 5:10 --size=10 -O css --name=neutral
undefinedrampa -C "#3b82f6" -L 98:5 -S 5:10 --size=10 -O css --name=neutral
undefinedOutput Structure
输出结构
css
:root {
/* Primary Accent */
--accent-0: #f0f7ff;
--accent-1: #dbeafe;
/* ... */
--accent-9: #1e3a5f;
/* Secondary Accent (complementary) */
--complementary-1-0: #fff7ed;
--complementary-1-1: #ffedd5;
/* ... */
/* Neutrals */
--neutral-0: #fafafa;
--neutral-1: #f5f5f5;
/* ... */
--neutral-9: #171717;
}css
:root {
/* 主强调色 */
--accent-0: #f0f7ff;
--accent-1: #dbeafe;
/* ... */
--accent-9: #1e3a5f;
/* 次要强调色(互补色) */
--complementary-1-0: #fff7ed;
--complementary-1-1: #ffedd5;
/* ... */
/* 中性色 */
--neutral-0: #fafafa;
--neutral-1: #f5f5f5;
/* ... */
--neutral-9: #171717;
}Light vs Dark Mode
明暗模式适配
The same ramps work for both modes - just map them differently:
Light Mode:
- Background: to
neutral-0neutral-2 - Text: to
neutral-8neutral-9 - Accent: to
accent-5accent-7
Dark Mode:
- Background: to
neutral-9neutral-7 - Text: to
neutral-0neutral-2 - Accent: to
accent-3accent-5
同一色阶可同时用于两种模式,只需按不同方式映射:
浅色模式:
- 背景色:至
neutral-0neutral-2 - 文字色:至
neutral-8neutral-9 - 强调色:至
accent-5accent-7
深色模式:
- 背景色:至
neutral-9neutral-7 - 文字色:至
neutral-0neutral-2 - 强调色:至
accent-3accent-5
Tips
小贴士
- The complementary color is mathematically guaranteed to contrast with the primary
- Neutrals inherit subtle warmth/coolness from the brand color
- Use for more granular control
--size=11 - Adjust range for more/less contrast (e.g.,
-Lfor less extreme)-L 90:20
- 互补色在数学上保证与主色形成足够对比
- 中性色会继承品牌色的微妙暖调/冷调
- 使用 可获得更精细的控制
--size=11 - 调整 范围可增加/减少对比度(例如,
-L可降低极端程度)-L 90:20