Polis.Core.VisualPresets (Packages/PolisCore/VisualPresets)VisualPreset = data. A list of records, each is a visual ID + a value (e.g. BackgroundColor = red)VisualSwitcher = view. A list of records, each is a visual ID + a target (e.g. BackgroundColor -> this Image)VisualSwitcher field to the view component and a VisualPreset field to the data (e.g. a definition ScriptableObject)[SerializeField]
private VisualSwitcher _Visual;
public void Show(MyDefinition definition)
{
_Visual.Apply(definition.Visual);
}
Example: every WindowDefinition has a Visual preset with background color, icon, name and tooltip. AppWindow and WindowButton apply it with their own switchers. WindowButton also passes it to IVisualPresetReceivers such as the tooltip

SettingsWindow definition visual
Apply also takes a single record, a list of records, or a list of presets
ApplyExclusive(preset) - like Apply, but IDs the preset leaves out go back to their values from before the first apply. Use it for reused views (list items, pooled tooltips)
Capture() - current target values as a preset
VisualPresetSample component has a preset, a switcher and an Apply button, handy for testing
Preset helpers: TryGetRecord(id, out record), WithRecord(record) (replace one value), CombineWith(other), VisualPreset.Combine(...)
ScriptableObject that inherits ABaseVisualID (an AUniqueDefinition, so it has a stable UniqueID from the file name without the ID suffix, e.g. BackgroundColor)ColorVisualID - ColorSpriteVisualID - SpriteStringVisualID - string, or a LocalizedString with Unity LocalizationMaterialVisualID - MaterialPrefabVisualID - prefab GameObjectMultiStateVisualID - a state name. The ID lists its Available StatesFontSymbolVisualID - FontSymbol (icon glyph)UVDecalVisualID - UVDecalPreset