@capacitor-community/screen-brightness
Capacitor community plugin for controlling screen brightness on iOS and Android devices.
Maintainer | GitHub | Social |
---|---|---|
Ely Lucas | elylucas | @elylucas |
Plugin | Capacitor | Documentation |
---|---|---|
6.x | 6.x | README |
5.x | 5.x | README |
4.x | 4.x | README |
1.x | 3.x | README |
npm install @capacitor-community/screen-brightness
npx cap sync
No configuration required for this plugin
import { ScreenBrightness } from '@capacitor-community/screen-brightness';
// Set the brightness:
const brightness = 0.5;
await ScreenBrightness.setBrightness({ brightness });
// Get the current brightness:
const {brightness: currentBrightness} = await ScreenBrightness.getBrightness();
SetBrightnessOptions
| Options to set brightness |
**Since:** 1.0.0
--------------------
### getBrightness()
```typescript
getBrightness() => PromisePromise<GetBrightnessReturnValue>
--------------------
### Interfaces
#### SetBrightnessOptions
| Prop | Type | Description | Since |
| ---------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| **`brightness`** | number
| The level to set the brightness to, from 0.0 (very dim) to 1.0 (full brightness) On Android, setting the value to -1 restores the user configured brightness. | 1.0.0 |
#### GetBrightnessReturnValue
| Prop | Type | Description | Since |
| ---------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| **`brightness`** | number
| The current brightness level, from 0.0 (very dim) to 1.0 (full brightness) On Android it returns -1 if the value has not been changed by the app. | 1.0.0 |