.. _xml: ====== Syntax ====== Naming conventions ****************** - A standard XML syntax is used. - Lowercase letters with ``_`` separation are used for attribute names. - The usual variable name rules apply for attribute and tag names: only letters, numbers, ``'_'`` and cannot start with a number. - LVGL API is followed as much as possible, e.g., ``align="center"``, ``bg_color="0xff0000"``. - For colors, all these options are supported: ``0x112233``, ``#112233``, ``112233``, ``0x123``, ``#123``, ``123``. - ``params`` can be referenced with ``$``. - ``consts`` can be referenced with ``#``. - ``styles`` can be attached to states and/or parts like ``styles="style1 style2:pressed style3:focused:scrollbar"``. - Local styles can be used like ````. Types ***** All of the types can be used as API property types, but only a subset of them can be used as constant and subject types. Simple types ------------ The following simple built-in types are supported: - ``bool``: ``true`` or ``false``. - ``int``: Integer number in the range of -2M to 2M by default. (``int32_t`` in C) - ``px``: Simple pixel unit. The unit ``px`` can be omitted. - ``%``: Percentage. ``%`` must be appended as a unit. (Means :cpp:expr:`lv_pct()`) - ``content``: Means ``LV_SIZE_CONTENT``. - ``string``: Simple ``\0`` terminated string. When multiple strings are used in a property or string array, ``'`` should be used. E.g. ``foo="'a' 'b'"``. - ``color``: A color stored as 24-bit RGB. (:cpp:expr:`lv_color_t`) - ``opa``: Opacity value in the range of 0 to 255 or 0 to 100%. - ``lv_obj``: Pointer to a widget (:cpp:expr:`lv_obj_t *`). - ``point``: A point with ``x`` and ``y`` values. (:cpp:expr:`lv_point_t`) - ``arglist``: Just list all the parameters as arguments. Supports only ``int`` and ``string``. E.g. ``foo="1 23 'hello' 'a'"``. Name-based types ---------------- In XML files, fonts, images, styles, etc., are not used by pointer but by string names. For example, a style is defined like ``