Topics

Note Selector

Attribute Overrides

Monday, June 19, 2023

Attribute overrides will be a set of child-attributes, associated with states/state combinations, that override a parent attribute when the state combination is matched.

Overrides will also support linking and command scripts.

Themeables will manage the state combination depending on a set of state pools. When requesting the values of its attributes, a themeable would pass down the current state combination. If a matching override exists, then its value is returned back.

Multiple State Pools

When multiple state pools are available, and an override only specifies a single state, its value would be used if that state appears in the combination, regardless of the other state pool.

Consider the following:

StatePool("Hovering")
- "Hovered"
- "Unhovered"

StatePool("Status")
- "Active"
- "Inactive"

OverrideAttribute("Active")

Since the override attribute only specifies a state from one pool, it is assumed to be valid for any of the states in the other pool. For example:

            OverrideAttribute("Active")
- StateCombination("Active:Hovered")     | Valid
- StateCombination("Active:Unhovered")   | Valid
- StateCombination("Inactive:Hovered")   | Invalid
- StateCombination("Inactive:Unhovered") | Invalid

However, how would it work then if another override attribute specifies a state from the other pool?

            OverrideAttribute("Active")
1. StateCombination("Active:Hovered")     | Valid
2. StateCombination("Active:Unhovered")   | ?
3. StateCombination("Inactive:Hovered")   | Invalid
4. StateCombination("Inactive:Unhovered") | Invalid

OverrideAttribute("Unhovered")
1. StateCombination("Active:Hovered")     | Invalid
2. StateCombination("Active:Unhovered")   | ?
3. StateCombination("Inactive:Hovered")   | Invalid
4. StateCombination("Inactive:Unhovered") | Valid
  • The override with the highest number of matching states should take priority.
  • When overrides collide, the default will be used. You may consider a way of detecting and alerting about collisions.