.. _xml_styles:
======
Styles
======
Overview
********
In XML files, both style sheets (:cpp:expr:`lv_style_t`) and local styles can be used.
Style variants are also supported to change style properties at runtime.
Style Sheets
************
In the ```` section, styles and their properties can be defined like this:
.. code-block:: xml
Styles can be referenced like this in the ````:
.. code-block:: xml
As shown in the example, parts and states are appended after a ``:`` to the style's name.
Local Styles
************
Local styles can be used directly in a widget, for example:
.. code-block:: xml
Style Variants
**************
The ``
```` elements allow altering styles at runtime.
The ``variant_`` subjects of the component library are used for each setting, and an observer callback is generated with all the style properties valid for that variant. The observer callback first resets the style and then sets all the properties.
This feature is not supported yet.
Gradients
*********
Before the ```` tag, the ```` tag can be used to describe various gradients, which can later be referenced in styles.
When a gradient is created, it can be referenced by its name, like:
.. code-block:: xml
or
.. code-block:: xml
Horizontal or Vertical Gradient
-------------------------------
Define simple ```` or ```` gradients:
.. code-block:: xml
Linear Gradient
---------------
Define a skewed gradient from two points:
.. code-block:: xml
Radial Gradient
---------------
Define a radial gradient:
.. code-block:: xml
Conical Gradient
----------------
Define a conical gradient:
.. code-block:: xml