个人技术分享

@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博客