@capacitor-community/screen-brightness
TypeScript icon, indicating that this package has built-in type declarations

5.0.0 • Public • Published


Screen Brightness

@capacitor-community/screen-brightness

Capacitor community plugin for controlling screen brightness on iOS and Android devices.


Maintainers

Maintainer GitHub Social
Ely Lucas elylucas @elylucas

Versions

Plugin Capacitor Documentation
5.x 5.x README
4.x 4.x README
1.x 3.x README

Installation

npm install @capacitor-community/screen-brightness
npx cap sync

Configuration

No configuration required for this plugin

Usage

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();

API

setBrightness(...)

setBrightness(options: SetBrightnessOptions) => Promise<void>

Sets the brightness level. On iOS, it sets the system level brightness, and on Android it sets the brightness for the current view.

Param Type Description
options SetBrightnessOptions Options to set brightness

Since: 1.0.0


getBrightness()

getBrightness() => Promise<GetBrightnessReturnValue>

Returns info than contains the current brightness level

  • @since 1.0.0

Returns: Promise<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

Readme

Keywords

Package Sidebar

Install

npm i @capacitor-community/screen-brightness

Weekly Downloads

4,006

Version

5.0.0

License

MIT

Unpacked Size

22.5 kB

Total Files

23

Last publish

Collaborators

  • ionicjs
  • danielprrazevedo
  • nkalupahana
  • dtarnawsky
  • ryaa
  • dallasjames
  • tafelnl
  • thegnuu
  • pbowyer
  • capcombot
  • jcesarmobile
  • maxlynch
  • mhartington
  • dotnetkow
  • it_mike_s
  • byrds
  • rdlabo
  • priyankpatel
  • dwieeb
  • stewan
  • arielhernandezmusa
  • jeepq
  • start9keagan
  • boosten
  • nklayman
  • ihadeed
  • ckgaparajita
  • jpender
  • nhyatt
  • pwespi
  • epicshaggy
  • thomasvidas
  • robingenz
  • diachedelic
  • johnborges
  • tobyas
  • elylucas
  • larsmikkelsen
  • giodimiliaionic
  • brownoxford
  • mrbatista
  • bazuka5801
  • hemang