Control the device screen brightness.

Usage #

This API allows you to control the screen brightness and toggle between automatic and manual brightness modes. You can specify the desired brightness level or enable automatic brightness adjustment.

Arguments #

ArgumentTypeDescription
brightnessIntegerOptional. The desired screen brightness level (0-255).
autoBooleanOptional. Set to true to enable automatic brightness mode or false for manual mode.

Example #

Set Brightness Level to 100 #

~/ $ termux-brightness --brightness 100
Output: Brightness set to 100.

Enable Automatic Brightness #

~/ $ termux-brightness --auto true
Output: Automatic brightness enabled.

Behavior #

  • If no arguments are provided, the brightness level defaults to 0.
  • Brightness levels are clamped between 0 (minimum brightness) and 255 (maximum brightness).
  • The auto mode determines whether the screen brightness is manually set or automatically adjusted based on ambient light.