1# LED (lv_led) 2 3## Overview 4 5The LEDs are rectangle-like (or circle) object whose brightness can be adjusted. With lower brightness the colors of the LED become darker. 6 7## Parts and Styles 8The LEDs have only one main part, called `LV_LED_PART_MAIN` and it uses all the typical background style properties. 9 10## Usage 11 12### Color 13You can set the color of the LED with `lv_led_set_color(led, lv_color_hex(0xff0080))`. 14This will be used as background color, border color, and shadow color. 15 16### Brightness 17You can set their brightness with `lv_led_set_bright(led, bright)`. The brightness should be between 0 (darkest) and 255 (lightest). 18 19### Toggle 20Use `lv_led_on(led)` and `lv_led_off(led)` to set the brightness to a predefined ON or OFF value. The `lv_led_toggle(led)` toggles between the ON and OFF state. 21 22## Events 23- `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` is sent for the following types: 24 - `LV_LED_DRAW_PART_RECTANGLE` The main rectangle. `LV_OBJ_DRAW_PART_RECTANGLE` is not sent by the base object. 25 - `part`: `LV_PART_MAIN` 26 - `rect_dsc` 27 - `draw_area`: the area of the rectangle 28 29 30See the events of the [Base object](/widgets/obj) too. 31 32Learn more about [Events](/overview/event). 33 34## Keys 35No *Keys* are processed by the object type. 36 37Learn more about [Keys](/overview/indev). 38 39## Example 40 41```eval_rst 42 43.. include:: ../../../examples/widgets/led/index.rst 44 45``` 46 47## API 48 49```eval_rst 50 51.. doxygenfile:: lv_led.h 52 :project: lvgl 53 54``` 55