重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
material-design-3 by 7spade/black-tortoise
npx skills add https://github.com/7spade/black-tortoise --skill material-design-3本技能提供关于 Material Design 3(也称为 Material You)的全面指导,这是 Google 最新的设计系统,强调为 Angular 应用程序提供个性化、可访问性和现代 UI 模式。
Material Design 3 是 Google 最新的设计语言,引入了:
在以下情况下使用 Material Design 3 指导:
Material Design 3 引入了复杂的色彩系统:
色彩角色:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
色彩变体:
primary-container)on-primary-container)Material Design 3 的标志性功能:
五种排版比例:
三种海拔高度策略:
具有四种比例的圆角系统:
// 使用 M3 令牌定义您的主题
@use '@angular/material' as mat;
// 包含核心 Material Design 3 样式
@include mat.core();
// 定义您的调色板
$my-primary: mat.define-palette(mat.$azure-palette);
$my-accent: mat.define-palette(mat.$blue-palette);
$my-warn: mat.define-palette(mat.$red-palette);
// 创建主题
$my-theme: mat.define-theme((
color: (
theme-type: light,
primary: $my-primary,
tertiary: $my-accent,
),
typography: (
brand-family: 'Roboto',
bold-weight: 700
),
density: (
scale: 0
)
));
// 应用主题
@include mat.all-component-themes($my-theme);
// 深色主题变体
$my-dark-theme: mat.define-theme((
color: (
theme-type: dark,
primary: $my-primary,
tertiary: $my-accent,
)
));
// 在需要时应用深色主题
.dark-theme {
@include mat.all-component-colors($my-dark-theme);
}
// 在您的组件中访问主题颜色
.my-component {
background-color: var(--mat-sys-primary);
color: var(--mat-sys-on-primary);
&:hover {
background-color: var(--mat-sys-primary-container);
color: var(--mat-sys-on-primary-container);
}
}
// 表面变体
.surface {
background-color: var(--mat-sys-surface);
color: var(--mat-sys-on-surface);
}
.surface-container {
background-color: var(--mat-sys-surface-container);
}
// 使用排版令牌
.heading {
font: var(--mat-sys-headline-large);
}
.body-text {
font: var(--mat-sys-body-medium);
}
.label {
font: var(--mat-sys-label-small);
}
.elevated-card {
// 级别 1 海拔高度
box-shadow: var(--mat-sys-level1);
&:hover {
// 悬停时的级别 2 海拔高度
box-shadow: var(--mat-sys-level2);
}
}
// 示例:Angular 中的动态主题切换
export class ThemeService {
private isDark = signal(false);
toggleTheme() {
this.isDark.update(dark => !dark);
document.body.classList.toggle('dark-theme', this.isDark());
}
applyCustomColors(sourceColor: string) {
// 从源色彩生成 M3 调色板
const palette = this.generateM3Palette(sourceColor);
this.applyCSSVariables(palette);
}
}
@Component({
selector: 'app-custom-button',
template: `
<button class="m3-button" [class.filled]="variant === 'filled'">
<ng-content></ng-content>
</button>
`,
styles: [`
.m3-button {
padding: 10px 24px;
border-radius: var(--mat-sys-corner-full);
font: var(--mat-sys-label-large);
border: none;
cursor: pointer;
&.filled {
background-color: var(--mat-sys-primary);
color: var(--mat-sys-on-primary);
&:hover {
background-color: var(--mat-sys-primary-container);
color: var(--mat-sys-on-primary-container);
}
}
&.outlined {
background-color: transparent;
border: 1px solid var(--mat-sys-outline);
color: var(--mat-sys-primary);
}
}
`]
})
export class CustomButtonComponent {
@Input() variant: 'filled' | 'outlined' = 'filled';
}
| 问题 | 解决方案 |
|---|---|
| 色彩未应用 | 确保首先调用 @include mat.core() |
| 主题令牌未定义 | 检查 Angular Material 版本(需要 v15+) |
| 深色主题不工作 | 验证 .dark-theme 类是否应用于父元素 |
| 自定义颜色不工作 | 使用带有正确 Material 调色板的 define-palette() |
| 排版未加载 | 在 index.html 中包含 Material Design 字体(Roboto) |
| 可访问性对比度问题 | 使用 Material 内置的色彩角色而非自定义颜色 |
从 M2 迁移到 M3 时的关键变化:
项目级技能:
/.github/skills/material-design-3/skill.md
个人全局技能:
~/.github/skills/material-design-3/skill.md
当提到 Material Design 3 主题时,Copilot 将自动加载此技能。
每周安装次数
68
仓库
首次出现
2026年1月26日
安全审计
安装于
opencode50
gemini-cli48
codex47
github-copilot43
claude-code42
amp30
This skill provides comprehensive guidance on Material Design 3 (also known as Material You), Google's latest design system that emphasizes personalization, accessibility, and modern UI patterns for Angular applications.
Material Design 3 is Google's latest design language that introduces:
Use Material Design 3 guidance when:
Material Design 3 introduces a sophisticated color system:
Color Roles:
Color Variants:
primary-container)on-primary-container)Material Design 3's signature feature:
Five typography scales:
Three elevation strategies:
Rounded corner system with four scales:
// Define your theme using M3 tokens
@use '@angular/material' as mat;
// Include core Material Design 3 styles
@include mat.core();
// Define your color palette
$my-primary: mat.define-palette(mat.$azure-palette);
$my-accent: mat.define-palette(mat.$blue-palette);
$my-warn: mat.define-palette(mat.$red-palette);
// Create the theme
$my-theme: mat.define-theme((
color: (
theme-type: light,
primary: $my-primary,
tertiary: $my-accent,
),
typography: (
brand-family: 'Roboto',
bold-weight: 700
),
density: (
scale: 0
)
));
// Apply the theme
@include mat.all-component-themes($my-theme);
// Dark theme variant
$my-dark-theme: mat.define-theme((
color: (
theme-type: dark,
primary: $my-primary,
tertiary: $my-accent,
)
));
// Apply dark theme when needed
.dark-theme {
@include mat.all-component-colors($my-dark-theme);
}
// Access theme colors in your components
.my-component {
background-color: var(--mat-sys-primary);
color: var(--mat-sys-on-primary);
&:hover {
background-color: var(--mat-sys-primary-container);
color: var(--mat-sys-on-primary-container);
}
}
// Surface variants
.surface {
background-color: var(--mat-sys-surface);
color: var(--mat-sys-on-surface);
}
.surface-container {
background-color: var(--mat-sys-surface-container);
}
// Using typography tokens
.heading {
font: var(--mat-sys-headline-large);
}
.body-text {
font: var(--mat-sys-body-medium);
}
.label {
font: var(--mat-sys-label-small);
}
.elevated-card {
// Level 1 elevation
box-shadow: var(--mat-sys-level1);
&:hover {
// Level 2 elevation on hover
box-shadow: var(--mat-sys-level2);
}
}
// Example: Dynamic theme switching in Angular
export class ThemeService {
private isDark = signal(false);
toggleTheme() {
this.isDark.update(dark => !dark);
document.body.classList.toggle('dark-theme', this.isDark());
}
applyCustomColors(sourceColor: string) {
// Generate M3 palette from source color
const palette = this.generateM3Palette(sourceColor);
this.applyCSSVariables(palette);
}
}
@Component({
selector: 'app-custom-button',
template: `
<button class="m3-button" [class.filled]="variant === 'filled'">
<ng-content></ng-content>
</button>
`,
styles: [`
.m3-button {
padding: 10px 24px;
border-radius: var(--mat-sys-corner-full);
font: var(--mat-sys-label-large);
border: none;
cursor: pointer;
&.filled {
background-color: var(--mat-sys-primary);
color: var(--mat-sys-on-primary);
&:hover {
background-color: var(--mat-sys-primary-container);
color: var(--mat-sys-on-primary-container);
}
}
&.outlined {
background-color: transparent;
border: 1px solid var(--mat-sys-outline);
color: var(--mat-sys-primary);
}
}
`]
})
export class CustomButtonComponent {
@Input() variant: 'filled' | 'outlined' = 'filled';
}
| Issue | Solution |
|---|---|
| Colors not applying | Ensure @include mat.core() is called first |
| Theme tokens undefined | Check Angular Material version (requires v15+) |
| Dark theme not working | Verify .dark-theme class is applied to parent element |
| Custom colors not working | Use define-palette() with proper Material color palette |
| Typography not loading | Include Material Design fonts (Roboto) in index.html |
| Accessibility contrast issues | Use Material's built-in color roles instead of custom colors |
Key changes when migrating from M2 to M3:
Project-level skill:
/.github/skills/material-design-3/skill.md
Personal global skill:
~/.github/skills/material-design-3/skill.md
Copilot will automatically load this skill when Material Design 3 topics are mentioned.
Weekly Installs
68
Repository
First Seen
Jan 26, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode50
gemini-cli48
codex47
github-copilot43
claude-code42
amp30
前端设计技能指南:避免AI垃圾美学,打造独特生产级界面
53,200 周安装