Skip to main content

lv_obj_replace_style

Function lv_obj_replace_style 

Source
pub unsafe extern "C" fn lv_obj_replace_style(
    obj: *mut lv_obj_t,
    old_style: *const lv_style_t,
    new_style: *const lv_style_t,
    selector: lv_style_selector_t,
) -> bool
Expand description

Replaces a style of an object, preserving the order of the style stack (local styles and transitions are ignored). @param obj pointer to an object @param old_style pointer to a style to replace. @param new_style pointer to a style to replace the old style with. @param selector OR-ed values of states and a part to replace only styles with matching selectors. LV_STATE_ANY and LV_PART_ANY can be used

Examples: @code lv_obj_replace_style(obj, &yellow_style, &blue_style, LV_PART_ANY | LV_STATE_ANY); //Replace a specific style

lv_obj_replace_style(obj, &yellow_style, &blue_style, LV_PART_MAIN | LV_STATE_PRESSED); //Replace a specific style assigned to the main part when it is pressed @endcode