1# 背景设置 (系统接口) 2 3设置组件的背景样式。 4 5> **说明:** 6> 7> 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 8> 9> 当前页面仅包含本模块的系统接口,其他公开接口参见[背景设置](ts-universal-attributes-background.md)。 10 11## backgroundBrightness<sup>11+</sup> 12 13backgroundBrightness(params: BackgroundBrightnessOptions) 14 15设置组件背景提亮效果。 16 17**系统能力:** SystemCapability.ArkUI.ArkUI.Full 18 19**系统接口:** 此接口为系统接口 20 21**参数:** 22 23| 参数名 | 类型 | 必填 | 说明 | 24| ------------- | ---------------------------------------- | ---- | ---------------------------------------- | 25| params | [BackgroundBrightnessOptions](#backgroundbrightnessoptions11对象说明) | 是 | 设置组件背景提亮效果,包括:亮度变化速率,提亮程度。 | 26 27## BackgroundBlurStyleOptions<sup>10+</sup>对象说明 28 29继承自[BlurStyleOptions](ts-universal-attributes-foreground-blur-style-sys.md) 30 31## BackgroundBrightnessOptions<sup>11+</sup>对象说明 32 33**系统接口:** 此接口为系统接口 34 35| 名称 | 参数类型 | 必填 | 描述 | 36| ------------- | ---------------------------------------- | ---- | ---------------------------------------- | 37| rate | number | 是 | 亮度变化速率。亮度变化速率越大,亮度下降速度越快,亮度提升程度越低。<br/>默认值:0.0 <br/>取值范围:(0.0, +∞)<br/> | 38| lightUpDegree | number | 是 | 提亮程度。提亮程度越大,亮度提升程度越大。<br/> 默认值:0.0 <br/>取值范围:[-1.0, 1.0]<br/> | 39 40## 示例 41 42设置组件背景提亮效果。 43 44```ts 45// xxx.ets 46@Entry 47@Component 48struct BackgroundBrightnessDemo { 49 build() { 50 Column() { 51 Row() { 52 Text("BackgroundBrightness") 53 } 54 .width(200) 55 .height(100) 56 .position({ x: 100, y: 100 }) 57 .backgroundBlurStyle(BlurStyle.Thin, { colorMode: ThemeColorMode.LIGHT, adaptiveColor: AdaptiveColor.DEFAULT, scale: 1.0 }) 58 .backgroundBrightness({rate:0.5,lightUpDegree:0.5}) // 背景提亮效果 59 } 60 .width('100%') 61 .height('100%') 62 .backgroundImage($r('app.media.image')) 63 .backgroundImageSize(ImageSize.Cover) 64 } 65} 66``` 67 68效果图如下: 69 70rate和lightUpDegree参数值为0.5,0.5: 71 72 73 74修改rate和lightUpDegree参数值为0.5,-0.1: 75 76 77 78去掉backgroundBrightness的设置,效果如下: 79 80