Skip to main content

Overview

ImGuiStyle contains all the style configuration for Dear ImGui, including colors, sizes, padding, rounding, and spacing. You can modify the style during initialization or between frames.
During the frame, use PushStyleColor()/PopStyleColor() and PushStyleVar()/PopStyleVar() to temporarily modify style values.

Getting Style

GetStyle

Access the Style structure.
ImGuiStyle&
Reference to the current style
Example:

Style Presets

StyleColorsDark

New, recommended dark style (default).

StyleColorsLight

Light style, best used with borders and a custom thicker font.

StyleColorsClassic

Classic Dear ImGui style. Example:

ImGuiStyle Structure

Common Style Fields

Padding and Spacing

ImVec2
default:"(8, 8)"
Padding within a window.
ImVec2
default:"(4, 3)"
Padding within a framed rectangle (used by most widgets).
ImVec2
default:"(8, 4)"
Horizontal and vertical spacing between widgets/lines.
ImVec2
default:"(4, 4)"
Horizontal and vertical spacing between within elements of a composed widget.
float
default:"21.0f"
Horizontal indentation when entering a tree node. Generally equals (FontSize + FramePadding.x*2).
Example:

Rounding

float
default:"0.0f"
Radius of window corners. Set to 0.0f for rectangular windows.
float
default:"0.0f"
Radius of frame corners.
float
default:"9.0f"
Radius of scrollbar grab corners.
float
default:"0.0f"
Radius of grab corners for sliders.
float
default:"4.0f"
Radius of upper tab corners.
Example:

Border Sizes

float
default:"1.0f"
Thickness of border around windows. Generally set to 0.0f or 1.0f.
float
default:"0.0f"
Thickness of border around frames. Generally set to 0.0f or 1.0f.
float
default:"1.0f"
Thickness of border around popups/tooltips.

Anti-Aliasing

bool
default:"true"
Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU.
bool
default:"true"
Enable anti-aliased lines/borders using textures where possible. Requires backend to render with bilinear filtering.
bool
default:"true"
Enable anti-aliased edges around filled shapes (rounded rectangles, circles).
Example:

Scaling

ScaleAllSizes

Scale all spacing/padding/thickness values. Does not scale fonts.
float
Scale multiplier
Example:
For DPI scaling, also consider adjusting font size.

Style Editor

ShowStyleEditor

Add style editor block (not a window). You can pass in a reference ImGuiStyle structure to compare to, revert to and save to.
ImGuiStyle*
default:"NULL"
Reference style for comparison
Example:

ShowStyleSelector

Add style selector block (not a window), essentially a combo listing the default styles.
const char*
Label for the selector
bool
True if style was changed
Example:

Temporary Style Changes

See Colors for PushStyleColor()/PopStyleColor() and style variable functions.

Common Style Customizations

Flat Style

Rounded Style

Compact Style

Spacious Style

See Also

  • Colors - Color configuration and style colors
  • Fonts - Font configuration
  • ImGuiStyle - Complete style structure reference