How Semantic Styling Works

A GUI item either does or does not have a semantic style applied. This means there is no inbetween state where an item might have some semantic style information applied, it’s either turned on or turned off per-item.

When Semantic Styling Is Off

Then the GUI uses no semantic styling internally, so it just draws things like buttons using whatever settings are applied by the system.

This usually means the rendering and colour choices are quite different, e.g. the default may be to use a built in font renderer from the backend instead of actually selecting a font internally.

When Semantic Styling Is Turned On

If it’s blue it’s blue. If it’s bold it’s drawn thickly. If it’s Sans Serif or Times New Roman then the system should ideally try it’s best to find the correct matching font or inform the app of a problem otherwise.

The styling information is considered mission critical and is applied as much as possible, even if the system thinks blurple is a stupid colour, and it only affects layout when it changes the size of an item (e.g. larger/smaller font).

It Can Draw Things Plainly Too!

The semantic style information consists of a pixel colour (optional), a font (optional) and a set of flags. This means that, while semantic styling is decisively either turned on or turned off, when turned on it can also be used to indicate especially plain items. Themed backends in the future can use this mode to select more simple or less distracting rendering than the default.

Imperfect But Reliable

This behaviour shouldn’t be expected to be perfect but should be reliable. For example if you set a component to dark purple it may look more blueish or more reddish or darker or lighter depending on factors like theme, graphics backend, screen settings and button mode – however the button should be recognisably marked as being some usable approximation of your dark purple setting.

If a system theme or GUI backend can’t deal properly with the styling information then the user should still be informed of it, e.g. “dear blind person, this button in the thermostat is marked Red”. In more typical cases, this means that themes should fall back to the built-in rendering if they can’t process the semantic style (it’s considered more important than aesthetic theming).

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *