DrawGUI.Style
Pre-configured GUIStyle constants for consistent editor appearance across the Paragon framework. All styles are public static readonly and initialized from GUI.skin and EditorStyles with fluent Odin extension methods.
Definition
Namespace: Paragon.Editor Assembly: Paragon.Editor.dll
public static partial class DrawGUI
{
public static class Style
}Remarks
DrawGUI.Style provides a central library of GUIStyle presets that are used throughout the Paragon Editor. Rather than creating ad-hoc styles in each drawer or editor, all code references these shared constants.
Construction Pattern
Styles are built using Odin Inspector's fluent GUIStyle extension methods:
public static readonly GUIStyle LabelBold = Label.WithFontStyle(FontStyle.Bold);These methods (WithAlignment, WithFontStyle, WithFontSize, WithBackground, WithStretchHeight, WithPadding, WithBorder) return new GUIStyle instances — they do not mutate the original.
SettingsAreaStyle
The SettingsAreaStyle is loaded via reflection from Unity's internal SettingsGUIStyles class. This provides the exact style used by Unity's own settings panels for visual consistency.
Quick Lookup
No styling
Style.None
Fill height
Style.Fill
Left-aligned label
Style.Label
Centered label
Style.LabelCentered
Bold label
Style.LabelBold
Bold centered label
Style.LabelCenteredBold
Standard button
Style.Button
Pressed button
Style.ButtonPressed
Text input
Style.TextField
Centered text input
Style.TextFieldCentered
Help box container
Style.Box
Horizontal slider line
Style.Line
Selection highlight
Style.SelectionArea
Window panel
Style.Window
Settings panel area
Style.SettingsAreaStyle
Fields
None
GUIStyle
GUIStyle.none
Empty style — no visuals
Fill
GUIStyle
None
Stretches to fill available height
Label
GUIStyle
GUI.skin.label
Middle-left aligned label
LabelCentered
GUIStyle
GUI.skin.label
Middle-center aligned label
LabelBold
GUIStyle
Label
Bold variant of Label
LabelCenteredBold
GUIStyle
LabelCentered
Bold variant of LabelCentered
Button
GUIStyle
GUI.skin.button
Standard Unity button
ButtonPressed
GUIStyle
Button
Button with gray background (pressed state)
TextField
GUIStyle
EditorStyles.textField
Standard text input field
TextFieldCentered
GUIStyle
TextField
Center-aligned text input
Box
GUIStyle
EditorStyles.helpBox
Help box container (rounded border)
Line
GUIStyle
GUI.skin.horizontalSlider
Horizontal slider style (used as line)
SelectionArea
GUIStyle
"selectionRect"
Unity's selection rectangle highlight
Window
GUIStyle
GUI.skin.window
Window panel style with 5px padding, no stretch
SettingsAreaStyle
GUIStyle
Reflected from Unity
Unity's internal settings panel area style
Modifying Styles at Draw Time
Styles are readonly references, but GUIStyle objects are mutable. The Odin extension methods (WithFontSize, WithPadding, etc.) create new GUIStyle instances, so they are safe to use inline:
Do not mutate the static style objects directly Styles are shared across the entire editor. Directly modifying properties (e.g., Style.Label.fontSize = 24) would affect all code that references Style.Label. Always use With* methods for temporary modifications.
Common Pitfalls
SettingsAreaStyle uses reflection SettingsAreaStyle loads Unity's internal SettingsGUIStyles.settingsArea via reflection. If Unity changes this internal type in a future version, the null-forgiving ! operators will throw NullReferenceException at static initialization time.
Styles are initialized from GUI.skin GUI.skin is only valid during an OnGUI call. These static fields are initialized on first access, which is typically during editor GUI rendering. Accessing them from non-GUI contexts (e.g., static constructors of non-editor classes) may produce unexpected results.
Examples
Using Styles with DrawGUI
Using Styles with Layout Scopes
Button Styles
See Also
DrawGUI — core drawing methods that reference these styles
DrawGUI.Scope — layout scopes that accept styles
DrawGUI.Icon — icon caching
DrawGUI Overview — system overview
Last updated