Spacing & Density¶
Four integers on the theme drive every padding and margin SKINT draws.
| Token | Default | Drives |
|---|---|---|
panelPadding | 8 | Padding inside panels — outer, interface, foldout |
panelSpacing | 8 | Vertical gap between panels |
controlPadding | 4 | Padding inside controls — buttons, toolbars, search bar |
controlSpacing | 4 | Vertical gap between controls |
They are in the Theme Designer under Spacing, and in a preset file like any other theme value.
They are bases, not per-edge values¶
The fifteen distinct padding and margin values SKINT uses are derived from those four with fixed offsets. The outer panel sits two points wider than panelPadding, a foldout four, a button eight wider than controlPadding, and so on.
So raising panelPadding from 8 to 12 makes every panel roomier and keeps the relationships between them — the outer panel stays two points wider than the middle one. You retune the whole layout with one slider instead of re-tuning fifteen values against each other.
The trade, stated plainly
This does not eliminate the magic numbers — it names them, puts them in one file (SkintGeometry), and gives you a density control rather than sixty dials. The cost is that individual edges cannot be tuned in isolation. If you need the search bar's left padding to differ from its right, SKINT will not do that.
Exposing every edge would have meant about sixty integers in the designer, which nobody would tune individually. Four was judged the better trade.
Using the geometry in your own styles¶
SkintGeometry exposes every derived value as a named RectOffset, so your own styles can match the user's spacing instead of hardcoding their own:
var myStyle = new GUIStyle(EditorStyles.helpBox)
.SetPadding(SkintGeometry.PanelPadding)
.SetMargin(SkintGeometry.OuterPanelMargin);
Available: None, PanelPadding, OuterPanelPadding, OuterPanelMargin, FoldoutPadding, FoldoutMargin, SearchBarPadding, CompactControlPadding, CompactControlMargin, ToolbarPadding, ToolbarMargin, ToolbarTogglePadding, ButtonPadding, ButtonMargin, FilterActivePadding, TabHeaderMargin, SectionHeaderMargin.
Each is computed on read, so it always reflects the current theme.
Zero is safe¶
Every token is clamped at zero. Dragging a slider to its minimum, or hand-editing a preset to a negative value, cannot produce a negative RectOffset — Unity lays controls on top of each other when it gets one.
Changing spacing in code¶
Geometry is baked into the cached GUIStyle objects, so unlike a colour it does not appear until they are rebuilt:
var theme = ThemePersistenceService.GetTheme();
theme.panelPadding = 12;
ThemePersistenceService.SaveTheme(theme);
StyleDrawer.ApplyLiveStyleRefresh(); // required — colours do not need this
Compatibility with older presets¶
The spacing tokens were added after SKINT's first release. A preset written before they existed does not contain them, and loads with the defaults above rather than reading as zero — so an old preset looks exactly as it always did.
The defaults also reproduce SKINT's previous hardcoded values exactly, verified value by value, so introducing the tokens changed nothing about how any shipped preset renders.
Next¶
- Theming from Code — the full programmatic API