angular / angular/components

docs-bug(theming): Example with define-theme is outdated

未关闭
#30,701 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
area: theming docs P3
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

Documentation about define-theme seems to be outdated.

```
@use '@angular/material' as mat;

html {
@include mat.theme((
color: mat.$violet-palette,
typography: Roboto,
density: -2,
));
}
```

### Reproduction

You can check at:

https://material.angular.io/guide/theming#density

### Expected Behavior

The corret code should be:

```
$theme: mat.define-theme(
(
color: (
primary: mat.$azure-palette,
tertiary: mat.$violet-palette,
theme-type: light,
),
density: (
scale: -2,
),
)
);
```

### Actual Behavior

This code results in the following error:

`$config.density should be a density configuration object.`

I believe this error also occours with typography config.

### Environment

- Angular: 19
- CDK/Material: 19

贡献指南

打开贡献指南

调研方向

从 material.angular.io/guide/theming#density 的 theming 指南 density 部分开始,将文档中的示例与 issue 中显示的 define-theme 配置进行比较。更新过时的示例,使其 density 配置与预期代码一致,并检查 typography 示例是否存在相同问题。当指南不再显示会产生所报告错误的配置时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, sass
领域
documentation
Issue 类型
文档
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。