Themed Widgets¶
Every widget takes a label and a ref to your value, so it reads like EditorGUILayout with theming applied. All of them accept optional tooltip and isDisabled arguments.
using RevGaming.Skint;
CustomGUIElements.ThemedToggle("Enabled", ref _enabled, "Turn the feature on.");
CustomGUIElements.ThemedSlider("Strength", ref _strength, 0f, 1f);
CustomGUIElements.ThemedTextField("Name", ref _name);
CustomGUIElements.ThemedColorField("Tint", ref _tint);
Reference¶
| Call | Value type |
|---|---|
ThemedLabel(label) / (label, tooltip) / (label, MessageType) | — |
ThemedToggle(label, ref bool) | bool |
ThemedSlider(label, ref float, min, max) | float |
ThemedSliderWithField(label, ref float, min, max) | float + numeric entry |
ThemedIntSlider(label, ref int, min, max) | int |
ThemedFloatField(label, ref float) | float |
ThemedIntField(label, ref int) | int |
ThemedTextField(label, ref string) | string |
ThemedColorField(label, ref Color) | Color |
ThemedVector2Field / ThemedVector3Field / ThemedVector4Field | vectors |
ThemedPopup(label, ref int index, string[] options) | int |
ThemedEnum<T>(label, ref T) | any enum |
ThemedObjectField<T>(label, ref T) | any UnityEngine.Object |
ThemedProgressBar.Draw(progress, label) | — |
Disabled controls¶
Pass isDisabled: true rather than wrapping in EditorGUI.DisabledScope. SKINT draws disabled text in a themed colour the user controls, which a disabled scope would override with Unity's own grey:
CustomGUIElements.ThemedToggle("Advanced mode", ref _advanced,
tooltip: "Requires a licence.",
isDisabled: !_hasLicence);
Disabled text and contrast
Disabled text is the one place SKINT's shipped presets do not guarantee WCAG AA contrast, because WCAG 1.4.3 explicitly exempts inactive controls. If you are using disabled state to convey something a user must read, consider a ThemedLabel with MessageType.Info instead.
Labels with a message type¶
ThemedLabel takes a MessageType for inline info, warnings and errors drawn in the themed helpbox style:
CustomGUIElements.ThemedLabel("No prefabs selected.", MessageType.Info);
CustomGUIElements.ThemedLabel("This will overwrite existing files.", MessageType.Warning);
Enums and popups¶
ThemedEnum<T> works with any enum and handles the ref round-trip for you:
private MyMode _mode = MyMode.Fast;
CustomGUIElements.ThemedEnum("Mode", ref _mode);
For a list that is not an enum, use ThemedPopup with a parallel index:
private int _selected;
private readonly string[] _options = { "Low", "Medium", "High" };
CustomGUIElements.ThemedPopup("Quality", ref _selected, _options);
Styling a stock control yourself¶
If a control you need is not in the list, StyleCache exposes the individual cached styles directly — OuterPanelStyle, ContentLabelStyle, CustomButtonStyle, SearchBarStyle, HelpBoxLabelStyle and others — so you can pass one to any EditorGUILayout call:
EditorGUILayout.LabelField("Custom", StyleCache.ContentLabelStyle);
EditorGUILayout.BeginVertical(StyleCache.GetPanelStyle("Middle"));
Reading these is cheap. They are cached and rebuilt only when the theme or the editor skin changes — do not cache them yourself in a field, or you will hold a stale style across a theme change.
Next¶
- Layout Helpers — headers, groups, separators and indentation
- Spacing & Density — the four tokens behind every padding