Allow me to mention that this is one of the things I try to solve by controlling openHASP via Python iso yaml/json.
First there is the mechanism where a style is assigned to a design. One can use a provided style or one can define their own. Looking at the hallo_world example, it includes an (predefined) style (see code) and assigns that to the design without any modifications (see code). After that, all objects created in the design will use the parameters provided by the style, but individual object can override that if needed. An example of a style definition looks like this
PAL_LIGHTGRAY = "#EBE4D1"
PAL_BLUE = "#26577C"
PAL_OCHER = "#E55604"
PAL_LIGHTBLUE = "#647D87"
style = ( {"page.gb_color": PAL_LIGHTGRAY,
"text.font": 32,
"text.color": PAL_OCHER,
"text.align": "center",
"text.on.color": "Gold",
"text.off.color": "Linen",
"btn.text_color": PAL_BLUE,
"btn.font": 32,
"btn.bg_color": PAL_LIGHTGRAY,
"btn.radius": 20,
"btn.align": "center",
"btn.border_color": PAL_LIGHTBLUE,
"btn.border_width": 2,
"btn.on.bg_color": PAL_OCHER,
"btn.off.bg_color": PAL_LIGHTGRAY,
"btn.unavailable.bg_color": "Red",
"btn.icon.font": 32,
"btn.shadow": ("Black", 50, 15, (8,8)),
"switch.border_color": PAL_LIGHTBLUE,
"switch.off.bg_color": PAL_LIGHTGRAY,
"switch.on.bg_color": PAL_OCHER,
"switch.knob_color": PAL_BLUE,
"switch.shadow": ("Black", 50, 15, (8,8)),
"slider.border_color": PAL_LIGHTBLUE,
"slider.off.bg_color": PAL_LIGHTGRAY,
"slider.on.bg_color": PAL_OCHER,
"slider.knob_color": PAL_BLUE,
"slider.radius": 20,
"slider.shadow": ("Black", 50, 15, (8,8)),
"nav.text_color": PAL_BLUE,
"nav.bg_color": PAL_LIGHTGRAY,
"nav.active.text_color": PAL_LIGHTGRAY,
"nav.active.bg_color": PAL_BLUE,
"nav.font": 32,
"line.color": "Linen",
"line.width": 10,
"clock.color": PAL_OCHER,
})
In addition, inheritance at Python level allows to inherit and/or alter layout and behavior aspects of objects by making your own versions. Suppose one needs some buttons that ask for confirmation before changing state, one could make its own version deriving from the standard Button to have that behavior.
Of course, this approach requires one is a bit familiar with Python.