Loading...
Loading...
Compare original and translation side by side
@import "tailwindcss";
@plugin "@duskmoon-dev/core/plugin";
@import "phoenix_duskmoon/components";@import "tailwindcss";
@plugin "@duskmoon-dev/core/plugin";
@import "phoenix_duskmoon/components";<html lang="en" data-theme="sunshine">sunshinemoonlight<html lang="en" data-theme="sunshine">sunshinemoonlight<body class="bg-surface text-on-surface">surfaceon-surface<body class="bg-surface text-on-surface">surfaceon-surface<.dm_theme_switcher />ThemeSwitcher<.dm_theme_switcher />ThemeSwitcher| Component | Color | Class / Pattern |
|---|---|---|
| Appbar | primary | |
| Page background | surface | |
| Sidebar | secondary | |
| Footer | surface-container-high | |
| Bottom nav | primary | |
| Drawer | secondary | |
<.dm_appbar title={@page_title} sticky>
<:logo>...</:logo>
<:menu to={~p"/dashboard"} active={@active == :dashboard}>Dashboard</:menu>
<:user_profile><.dm_theme_switcher /></:user_profile>
</.dm_appbar>
<div class="flex">
<aside class="bg-secondary text-secondary-content w-64 min-h-screen p-4">
<.dm_left_menu active={@current_path}>
<:menu>...</:menu>
</.dm_left_menu>
</aside>
<main class="flex-1 p-6">
<%= @inner_content %>
</main>
</div>
<.dm_page_footer label="© 2026 MyApp" />| 组件 | 颜色 | 类名 / 模式 |
|---|---|---|
| 应用栏 | primary | |
| 页面背景 | surface | |
| 侧边栏 | secondary | |
| 页脚 | surface-container-high | |
| 底部导航 | primary | |
| 抽屉 | secondary | |
<.dm_appbar title={@page_title} sticky>
<:logo>...</:logo>
<:menu to={~p"/dashboard"} active={@active == :dashboard}>Dashboard</:menu>
<:user_profile><.dm_theme_switcher /></:user_profile>
</.dm_appbar>
<div class="flex">
<aside class="bg-secondary text-secondary-content w-64 min-h-screen p-4">
<.dm_left_menu active={@current_path}>
<:menu>...</:menu>
</.dm_left_menu>
</aside>
<main class="flex-1 p-6">
<%= @inner_content %>
</main>
</div>
<.dm_page_footer label="© 2026 MyApp" />| Component | Default | When to Change |
|---|---|---|
| Primary button | | Main page action — one per view |
| Secondary button | | Alternative actions |
| Tertiary button | | Accent features, special highlights |
| Destructive button | | Delete, remove, irreversible |
| Ghost button | | Toolbar, low-emphasis, cancel |
| Link button | | Inline text actions |
| Outline button | | Medium emphasis, toggleable |
<div class="flex gap-2">
<.dm_btn variant="ghost">Cancel</.dm_btn>
<.dm_btn variant="primary">Save Changes</.dm_btn>
</div>| 组件 | 默认值 | 变更场景 |
|---|---|---|
| 主按钮 | | 页面核心操作——每个视图仅一个 |
| 次要按钮 | | 备选操作 |
| 三级按钮 | | 特色功能、特殊高亮 |
| 破坏性按钮 | | 删除、移除等不可逆操作 |
| 幽灵按钮 | | 工具栏、低强调、取消操作 |
| 链接按钮 | | 行内文本操作 |
| 轮廓按钮 | | 中等强调、可切换状态 |
<div class="flex gap-2">
<.dm_btn variant="ghost">Cancel</.dm_btn>
<.dm_btn variant="primary">Save Changes</.dm_btn>
</div>| Component | Color | Notes |
|---|---|---|
| Card | surface-container | Default CSS — no class needed |
| Card (elevated) | surface-container-high | Add |
| Modal / Dialog | surface-container-highest | Highest elevation |
| Tooltip | primary | |
| Popover | surface-container-high | |
| Accordion | surface-container | |
| Bottom sheet | surface-container-high | |
| Snackbar | inverse-surface or type-based | Use |
| 组件 | 颜色 | 说明 |
|---|---|---|
| 卡片 | surface-container | 默认CSS——无需额外类名 |
| 卡片(带阴影) | surface-container-high | 添加 |
| 模态框 / 对话框 | surface-container-highest | 最高层级 |
| 提示框 | primary | 默认 |
| 弹出框 | surface-container-high | |
| 折叠面板 | surface-container | |
| 底部面板 | surface-container-high | |
| Snackbar | inverse-surface 或基于类型 | 使用 |
| Component | Color | Notes |
|---|---|---|
| Badge | | Use |
| Chip | | Semantic colors for status: |
| Progress | | |
| Avatar | | Initials placeholder color |
| Stat | no color | |
| Timeline | semantic per item | |
| Table | no color | |
| 组件 | 颜色 | 说明 |
|---|---|---|
| 徽章 | | 使用 |
| 芯片 | | 状态使用语义色: |
| 进度条 | | 完成状态用 |
| 头像 | | 首字母占位符颜色 |
| 统计组件 | 无颜色 | 关键指标仅使用 |
| 时间线 | 每项使用语义色 | |
| 表格 | 无颜色 | |
| Component | Color | Notes |
|---|---|---|
| Input | no color | Uses outline border. Set |
| Checkbox | | |
| Radio | | |
| Switch | | |
| Select | no color | |
| Slider | | |
| Rating | | |
| 组件 | 颜色 | 说明 |
|---|---|---|
| 输入框 | 无颜色 | 使用轮廓边框,仅在强调场景设置 |
| 复选框 | | |
| 单选框 | | |
| 开关 | | |
| 选择器 | 无颜色 | |
| 滑块 | | |
| 评分组件 | | 星级评分用 |
| Component | Color | Notes |
|---|---|---|
| Alert | type-based | |
| Flash | kind-based | |
| Toast | type-based | Always set |
| Loading spinner | |
| 组件 | 颜色 | 说明 |
|---|---|---|
| 提示框 | 基于类型 | |
| 消息闪框 | 基于类型 | |
| 吐司提示 | 基于类型 | 需始终设置 |
| 加载 spinner | |
| Component | Color | Notes |
|---|---|---|
| Appbar | primary | Always |
| Navbar | surface-container-high | |
| Tabs | no color | Active = primary underline |
| Breadcrumb | on-surface-variant | Muted text |
| Steps | | Completed = filled, upcoming = outline |
| Left menu | secondary | Active item = primary-content highlight |
| 组件 | 颜色 | 说明 |
|---|---|---|
| 应用栏 | primary | 始终使用 |
| 导航栏 | surface-container-high | |
| 标签页 | 无颜色 | 激活项用主色调下划线 |
| 面包屑 | on-surface-variant | 弱化文本 |
| 步骤条 | | 已完成=填充,待完成=轮廓 |
| 左侧菜单 | secondary | 激活项用primary-content高亮 |
bg-blue-500text-slate-600<%# FORBIDDEN %>
<div style="background: #3b82f6;">
<div class="bg-blue-500 text-white">
<%# CORRECT %>
<div class="bg-primary text-primary-content">bg-blue-500text-slate-600<%# 禁止写法 %>
<div style="background: #3b82f6;">
<div class="bg-blue-500 text-white">
<%# 正确写法 %>
<div class="bg-primary text-primary-content">| Background | Text |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| 背景 | 文本 |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
surface (page)
├─ secondary (sidebar, drawer)
└─ surface-container (card)
└─ surface-container-high (navbar, popover, elevated card)
└─ surface-container-highest (dialog, tooltip)surface (页面)
├─ secondary (侧边栏、抽屉)
└─ surface-container (卡片)
└─ surface-container-high (导航栏、弹出框、带阴影卡片)
└─ surface-container-highest (对话框、提示框)successwarningerrorinfo<%# CORRECT %>
<.dm_alert variant="error">Validation failed</.dm_alert>
<.dm_badge variant="success">Active</.dm_badge>
<%# WRONG %>
<.dm_btn variant="success">Submit</.dm_btn> <%# Use primary %>successwarningerrorinfo<%# 正确写法 %>
<.dm_alert variant="error">验证失败</.dm_alert>
<.dm_badge variant="success">已激活</.dm_badge>
<%# 错误写法 %>
<.dm_btn variant="success">提交</.dm_btn> <%# 应使用primary %>| Role | Purpose | Examples |
|---|---|---|
| Primary | Brand identity, main actions, key focus | Appbar, main CTA, active nav |
| Secondary | Supporting actions, alternative emphasis | Secondary CTA, toggles |
| Tertiary | Special highlights, decorative accents | Feature badges, accent cards |
| 角色 | 用途 | 示例 |
|---|---|---|
| 主色调 | 品牌标识、核心操作、关键焦点 | 应用栏、主CTA、激活导航项 |
| 次要色调 | 辅助操作、备选强调 | 次要CTA、切换按钮 |
| 第三色调 | 特殊高亮、装饰性强调 | 功能徽章、强调卡片 |
variant="primary"secondaryghostoutlinevariant="primary"secondaryghostoutlinedm_mdidm_bsicurrentcolorcolor=dm_mdidm_bsicurrentcolorcolor=primary-containeron-primary-container<div class="bg-primary-container text-on-primary-container p-4 rounded-lg">
Featured content with softer emphasis
</div>primary-containeron-primary-container<div class="bg-primary-container text-on-primary-container p-4 rounded-lg">
带有柔和强调的特色内容
</div>/* Project CSS — after DuskMoon imports */
:root {
--font-display: 'Instrument Serif', serif;
--font-body: 'DM Sans', sans-serif;
--font-mono: 'JetBrains Mono', monospace;
}
body { font-family: var(--font-body); }
h1, h2, h3 { font-family: var(--font-display); }
code, pre { font-family: var(--font-mono); }/* 项目CSS —— 在DuskMoon导入之后 */
:root {
--font-display: 'Instrument Serif', serif;
--font-body: 'DM Sans', sans-serif;
--font-mono: 'JetBrains Mono', monospace;
}
body { font-family: var(--font-body); }
h1, h2, h3 { font-family: var(--font-display); }
code, pre { font-family: var(--font-mono); }| Element | Class | Usage |
|---|---|---|
| Page title | | One per page |
| Section heading | | |
| Card title | | |
| Body text | | Default |
| Secondary text | | Muted supporting info |
| Caption | | Timestamps, metadata |
| 元素 | 类名 | 用途 |
|---|---|---|
| 页面标题 | | 每页一个 |
| 区块标题 | | |
| 卡片标题 | | |
| 正文文本 | | 默认 |
| 次要文本 | | 弱化的辅助信息 |
| 说明文字 | | 时间戳、元数据 |
| Priority | Token | Usage |
|---|---|---|
| Primary text | | Headings, body text, labels |
| Secondary text | | Descriptions, hints, timestamps |
| Disabled text | | Disabled states |
| Link text | | Clickable inline text |
| 优先级 | 令牌 | 用途 |
|---|---|---|
| 主文本 | | 标题、正文、标签 |
| 次要文本 | | 描述、提示、时间戳 |
| 禁用文本 | | 禁用状态 |
| 链接文本 | | 可点击的行内文本 |
p-6p-8gap-6p-4gap-3gap-4gap-6max-w-7xl mx-automax-w-3xlp-6p-8gap-6p-4gap-3gap-4gap-6max-w-7xl mx-automax-w-3xl<div class="grid grid-cols-auto-fit-80 gap-6">
<.dm_card :for={item <- @items}>
<:title><%= item.name %></:title>
<%= item.description %>
</.dm_card>
</div><div class="grid grid-cols-auto-fit-80 gap-6">
<.dm_card :for={item <- @items}>
<:title><%= item.name %></:title>
<%= item.description %>
</.dm_card>
</div><div class="flex min-h-screen">
<aside class="bg-secondary text-secondary-content w-64 border-r border-outline-variant p-4 shrink-0">
<.dm_left_menu active={@current_path} />
</aside>
<main class="flex-1 bg-surface p-6 overflow-auto">
<%= @inner_content %>
</main>
</div><div class="flex min-h-screen">
<aside class="bg-secondary text-secondary-content w-64 border-r border-outline-variant p-4 shrink-0">
<.dm_left_menu active={@current_path} />
</aside>
<main class="flex-1 bg-surface p-6 overflow-auto">
<%= @inner_content %>
</main>
</div><section class="bg-surface-container-low p-8 rounded-2xl">
<h2 class="text-2xl font-semibold mb-6">Featured</h2>
<div class="grid grid-cols-3 gap-4">
<.dm_card shadow="md">...</.dm_card>
<.dm_card shadow="md">...</.dm_card>
<.dm_card shadow="md">...</.dm_card>
</div>
</section><section class="bg-surface-container-low p-8 rounded-2xl">
<h2 class="text-2xl font-semibold mb-6">Featured</h2>
<div class="grid grid-cols-3 gap-4">
<.dm_card shadow="md">...</.dm_card>
<.dm_card shadow="md">...</.dm_card>
<.dm_card shadow="md">...</.dm_card>
</div>
</section><body class="bg-surface text-on-surface">
<header class="bg-primary text-primary-content">...</header>
<div class="bg-surface-container-low -mt-8 pt-12 pb-8 rounded-t-3xl">
<div class="max-w-6xl mx-auto px-6">
<.dm_card shadow="lg" class="bg-surface-container">
...
</.dm_card>
</div>
</div>
</body><body class="bg-surface text-on-surface">
<header class="bg-primary text-primary-content">...</header>
<div class="bg-surface-container-low -mt-8 pt-12 pb-8 rounded-t-3xl">
<div class="max-w-6xl mx-auto px-6">
<.dm_card shadow="lg" class="bg-surface-container">
...
</.dm_card>
</div>
</div>
</body>.hero {
background: linear-gradient(
135deg,
var(--color-primary-container) 0%,
var(--color-tertiary-container) 100%
);
}.hero {
background: linear-gradient(
135deg,
var(--color-primary-container) 0%,
var(--color-tertiary-container) 100%
);
}.overlay {
background-color: hsl(var(--color-scrim) / 0.5);
backdrop-filter: blur(4px);
}.overlay {
background-color: hsl(var(--color-scrim) / 0.5);
backdrop-filter: blur(4px);
}outline-variantoutline<hr class="border-outline-variant" />
<div class="border border-outline rounded-lg">Interactive element</div>outline-variantoutline<hr class="border-outline-variant" />
<div class="border border-outline rounded-lg">交互式元素</div>* {
transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}* {
transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}.interactive-card {
transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.interactive-card:hover {
transform: translateY(-2px);
box-shadow: var(--shadow-md);
}.interactive-card {
transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.interactive-card:hover {
transform: translateY(-2px);
box-shadow: var(--shadow-md);
}@media (prefers-reduced-motion: reduce) {
* { transition: none !important; animation: none !important; }
}@media (prefers-reduced-motion: reduce) {
* { transition: none !important; animation: none !important; }
}translateY(-2px)dm_loading_spinnertranslateY(-2px)dm_loading_spinnerbg-blue-500text-gray-600bg-white/80surface-container-*style="color: ..."dm_*successerrorwarninginfobg-*text-*-contenttext-on-*bg-blue-500text-gray-600bg-white/80surface-container-*style="color: ..."dm_*successerrorwarninginfobg-*text-*-contenttext-on-*