56.HarmonyOS鸿蒙系统 App(ArkTS)调用color.json的配置颜色

@Entry
@Component
struct Index {
  @State message: string = 'Hello World'
  @State color2:string = '#ff1779f3'

  build() {
    Row() {
      Column() {
        Text(this.message)
          .fontSize(50)
          .fontWeight(FontWeight.Bold)
          .backgroundColor(this.color2)
        Text(this.message)
          .fontSize(50)
          .fontWeight(FontWeight.Bold)
          .backgroundColor($r('app.color.start_window_background'))
      }
      .width('100%')
    }
    .height('100%')
  }
}

color.json

{
  "color": [
    {
      "name": "start_window_background",
      "value": "#FF60F312"
    }
  ]
}

【HarmonyOS开发】ArkTs实现应用配色随系统深浅模式自动切换的三种方式_arkts获取系统颜色模式-CSDN博客

相关推荐

  1. 初识鸿蒙HarmonyOS系统

    2024-05-04 20:52:02       59 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-05-04 20:52:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-05-04 20:52:02       101 阅读
  3. 在Django里面运行非项目文件

    2024-05-04 20:52:02       82 阅读
  4. Python语言-面向对象

    2024-05-04 20:52:02       91 阅读

热门阅读

  1. 车载开发-Android Automotive平台

    2024-05-04 20:52:02       34 阅读
  2. git解决冲突问题

    2024-05-04 20:52:02       34 阅读
  3. 修改ETCD返回数据限额

    2024-05-04 20:52:02       32 阅读
  4. 2024/5/3 C++五一

    2024-05-04 20:52:02       38 阅读
  5. PPT基础

    PPT基础

    2024-05-04 20:52:02      35 阅读
  6. SpringCloud相关面试题(详细解答)

    2024-05-04 20:52:02       33 阅读
  7. 2024十大免费cms建站系统有哪些

    2024-05-04 20:52:02       35 阅读
  8. 某夸克pan之搜索接口

    2024-05-04 20:52:02       33 阅读
  9. AI做画的算法原理

    2024-05-04 20:52:02       24 阅读