js-apis-brightness.md 863 字节
Newer Older
S
shawn_he 已提交
1
# Brightness
Z
zengyawen 已提交
2

S
shawn_he 已提交
3
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
S
shawn_he 已提交
4
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Z
zengyawen 已提交
5

S
shawn_he 已提交
6 7 8 9
The Brightness module provides an API for setting the screen brightness.


## Modules to Import
Z
zengyawen 已提交
10

S
shawn_he 已提交
11
```js
Z
zengyawen 已提交
12 13 14
import brightness from '@ohos.brightness';
```

S
shawn_he 已提交
15
## brightness.setValue
W
wusongqing 已提交
16

S
shawn_he 已提交
17
setValue(value: number): void
W
wusongqing 已提交
18

S
shawn_he 已提交
19
Sets the screen brightness.
Z
zengyawen 已提交
20

S
shawn_he 已提交
21
This is a system API and cannot be called by third-party applications.
Z
zengyawen 已提交
22

S
shawn_he 已提交
23
**System capability:** SystemCapability.PowerManager.DisplayPowerManager
Z
zengyawen 已提交
24

S
shawn_he 已提交
25
**Parameters**
Z
zengyawen 已提交
26

S
shawn_he 已提交
27 28
| Name  | Type    | Mandatory  | Description         |
| ----- | ------ | ---- | ----------- |
S
shawn_he 已提交
29
| value | number | Yes   | Brightness value, ranging from **0** to **255**.|
Z
zengyawen 已提交
30

S
shawn_he 已提交
31 32
**Example**

S
shawn_he 已提交
33
```js
S
shawn_he 已提交
34 35
brightness.setValue(128);
```