文本和背景之间的颜色对比度至少为4.5:1以确保可读性。
@Entry
@Component
struct Index {
build() {
RelativeContainer() {
Text('message')
// app.color.color1=#ffffff
.fontColor($r('app.color.color1'))
// app.color.color2=#000000
.backgroundColor($r('app.color.color2'))
}
}
} @Entry
@Component
struct Index {
build() {
RelativeContainer() {
Text('message')
// app.color.color1=#000000
.fontColor($r('app.color.color1'))
// app.color.color2=#333333
.backgroundColor($r('app.color.color2'))
}
}
} plugin:@cross-device-app-dev/recommended plugin:@cross-device-app-dev/all
Code Linter代码检查规则的配置指导请参考Code Linter代码检查(ArkTS/TS)。