Overview
Dear ImGui provides comprehensive styling capabilities to customize the visual appearance of your UI. You can modify colors, spacing, rounding, and many other visual properties either globally or temporarily for specific UI elements.Style Structure
TheImGuiStyle structure contains all styling properties. Access it via:
Key Style Properties
Font Scaling
Font Scaling
FontSizeBase- Current base font size before external global factors are appliedFontScaleMain- Main global scale factorFontScaleDpi- Additional global scale factor from viewport/monitor contents scale
Alpha and Transparency
Alpha and Transparency
Alpha- Global alpha applies to everything in Dear ImGuiDisabledAlpha- Additional alpha multiplier applied by BeginDisabled()
Window Properties
Window Properties
WindowPadding- Padding within a windowWindowRounding- Radius of window corners roundingWindowBorderSize- Thickness of border around windows (generally 0.0f or 1.0f)WindowMinSize- Minimum window sizeWindowTitleAlign- Alignment for title bar text
Frame Properties
Frame Properties
FramePadding- Padding within a framed rectangle (used by most widgets)FrameRounding- Radius of frame corners roundingFrameBorderSize- Thickness of border around frames
Spacing and Layout
Spacing and Layout
ItemSpacing- Horizontal and vertical spacing between widgets/linesItemInnerSpacing- Spacing within elements of a composed widgetIndentSpacing- Horizontal indentation when entering a tree nodeCellPadding- Padding within a table cell
Scrollbar Properties
Scrollbar Properties
ScrollbarSize- Width of vertical scrollbar, height of horizontal scrollbarScrollbarRounding- Radius of grab corners for scrollbarScrollbarPadding- Padding of scrollbar grab within its frame
Tab Properties
Tab Properties
TabRounding- Radius of upper corners of a tabTabBorderSize- Thickness of border around tabsTabBarBorderSize- Thickness of tab-bar separatorTabBarOverlineSize- Thickness of tab-bar overline
Color Scheme
Dear ImGui uses an enumImGuiCol_ to identify 58 different color elements:
Text Colors
Window Colors
Frame Colors
Title Bar Colors
Button Colors
Widget Colors
Tab Colors
Table Colors
Modifying Colors
Direct Modification
Temporary Color Changes
UsePushStyleColor() and PopStyleColor() to temporarily change colors:
Using ImU32 Colors
Modifying Style Variables
UsePushStyleVar() and PopStyleVar() for temporary style changes:
Common Style Variables
Built-in Themes
Dear ImGui provides three built-in color themes:Dark Theme (Default)
Light Theme
Classic Theme
Style Editor
Dear ImGui includes a built-in style editor for live customization:Complete Styling Example
Tips and Best Practices
- Always use
PushStyleColor()/PushStyleVar()to modify styles mid-frame - Direct modification of
ImGuiStyleshould be done at initialization or between frames - Use the built-in style editor during development to experiment with values
- Keep track of push/pop pairs to avoid style stack errors
See Also
- Customization - Advanced styling techniques
- Best Practices - General ImGui best practices
- Examples - See styling in action