你好,目前仅支持置灰配置,请参考:目前可以通过grayscale为组件属性,可以为组件添加灰度效果,实现页面一键置灰效果关键代码为.grayscale(this.saturateValue) // 设置根组件的颜色饱和度 以下为简易demo请参考@Entry @Component struct TabsExample { @State selectedFontColor: string = '#007DFF' @State saturateValue: number = 0; build() { Column() { Row(){ Column().width(100).height(100).backgroundColor(Color.Pink) Column().width(100).height(100).backgroundColor(Color.Orange) } Button("页面置灰") .onClick(() => { this.saturateValue = 1; // 页面置灰 }) Button("恢复彩色") .onClick(() => { this.saturateValue = 0; // 页面复原 }) }.width('100%') .grayscale(this.saturateValue) // 设置根组件的颜色饱和度 } }
你好,目前仅支持置灰配置,请参考:目前可以通过grayscale为组件属性,可以为组件添加灰度效果,实现页面一键置灰效果
关键代码为
以下为简易demo请参考