dear_imgui_rs/
style.rs

1//! Styling and colors
2//!
3//! High-level access to Dear ImGui style parameters and color table. Use this
4//! module to read or tweak padding, rounding, sizes and retrieve or modify
5//! named colors via [`StyleColor`].
6//!
7//! Example:
8//! ```no_run
9//! # use dear_imgui_rs::*;
10//! # let mut ctx = Context::create();
11//! // Adjust style before building a frame
12//! {
13//!     let style = ctx.style_mut();
14//!     style.set_window_rounding(6.0);
15//!     style.set_color(StyleColor::WindowBg, [0.10, 0.10, 0.12, 1.0]);
16//! }
17//! // Optionally show the style editor for the current style
18//! # let ui = ctx.frame();
19//! ui.show_default_style_editor();
20//! ```
21//!
22//! Quick example (temporary style color):
23//! ```no_run
24//! # use dear_imgui_rs::*;
25//! # let mut ctx = Context::create();
26//! # let ui = ctx.frame();
27//! let c = ui.push_style_color(StyleColor::Text, [0.2, 1.0, 0.2, 1.0]);
28//! ui.text("green text");
29//! c.pop();
30//! ```
31//!
32#![allow(
33    clippy::cast_possible_truncation,
34    clippy::cast_sign_loss,
35    clippy::as_conversions
36)]
37use crate::internal::RawWrapper;
38use crate::sys;
39use crate::utils::HoveredFlags;
40use crate::widget::TreeNodeFlags;
41
42/// User interface style/colors
43///
44/// Note: This is a transparent wrapper over `sys::ImGuiStyle` (v1.92+ layout).
45/// Do not assume field layout here; use accessors or `raw()/raw_mut()` if needed.
46#[repr(transparent)]
47#[derive(Debug, Copy, Clone, PartialEq)]
48pub struct Style(pub(crate) sys::ImGuiStyle);
49
50impl Style {
51    /// Get a color by style color identifier
52    pub fn color(&self, color: StyleColor) -> [f32; 4] {
53        let c = self.0.Colors[color as usize];
54        [c.x, c.y, c.z, c.w]
55    }
56
57    /// Set a color by style color identifier
58    pub fn set_color(&mut self, color: StyleColor, value: [f32; 4]) {
59        self.0.Colors[color as usize] = sys::ImVec4 {
60            x: value[0],
61            y: value[1],
62            z: value[2],
63            w: value[3],
64        };
65    }
66
67    /// Get main font scale (formerly io.FontGlobalScale)
68    pub fn font_scale_main(&self) -> f32 {
69        self.0.FontScaleMain
70    }
71
72    /// Set main font scale (formerly io.FontGlobalScale)
73    pub fn set_font_scale_main(&mut self, scale: f32) {
74        self.0.FontScaleMain = scale;
75    }
76
77    /// Get DPI font scale (auto-overwritten if ConfigDpiScaleFonts=true)
78    pub fn font_scale_dpi(&self) -> f32 {
79        self.0.FontScaleDpi
80    }
81
82    /// Set DPI font scale
83    pub fn set_font_scale_dpi(&mut self, scale: f32) {
84        self.0.FontScaleDpi = scale;
85    }
86
87    /// Base size used by style for font sizing
88    pub fn font_size_base(&self) -> f32 {
89        self.0.FontSizeBase
90    }
91
92    pub fn set_font_size_base(&mut self, sz: f32) {
93        self.0.FontSizeBase = sz;
94    }
95
96    // Common style accessors (typed, convenient)
97
98    pub fn alpha(&self) -> f32 {
99        self.0.Alpha
100    }
101    pub fn set_alpha(&mut self, v: f32) {
102        self.0.Alpha = v;
103    }
104
105    pub fn disabled_alpha(&self) -> f32 {
106        self.0.DisabledAlpha
107    }
108    pub fn set_disabled_alpha(&mut self, v: f32) {
109        self.0.DisabledAlpha = v;
110    }
111
112    pub fn window_padding(&self) -> [f32; 2] {
113        [self.0.WindowPadding.x, self.0.WindowPadding.y]
114    }
115    pub fn set_window_padding(&mut self, v: [f32; 2]) {
116        self.0.WindowPadding = sys::ImVec2 { x: v[0], y: v[1] };
117    }
118
119    pub fn window_rounding(&self) -> f32 {
120        self.0.WindowRounding
121    }
122    pub fn set_window_rounding(&mut self, v: f32) {
123        self.0.WindowRounding = v;
124    }
125
126    pub fn window_border_size(&self) -> f32 {
127        self.0.WindowBorderSize
128    }
129    pub fn set_window_border_size(&mut self, v: f32) {
130        self.0.WindowBorderSize = v;
131    }
132
133    pub fn window_min_size(&self) -> [f32; 2] {
134        [self.0.WindowMinSize.x, self.0.WindowMinSize.y]
135    }
136    pub fn set_window_min_size(&mut self, v: [f32; 2]) {
137        self.0.WindowMinSize = sys::ImVec2 { x: v[0], y: v[1] };
138    }
139
140    pub fn window_title_align(&self) -> [f32; 2] {
141        [self.0.WindowTitleAlign.x, self.0.WindowTitleAlign.y]
142    }
143    pub fn set_window_title_align(&mut self, v: [f32; 2]) {
144        self.0.WindowTitleAlign = sys::ImVec2 { x: v[0], y: v[1] };
145    }
146
147    pub fn window_menu_button_position(&self) -> Direction {
148        Direction::from(self.0.WindowMenuButtonPosition)
149    }
150    pub fn set_window_menu_button_position(&mut self, d: Direction) {
151        self.0.WindowMenuButtonPosition = d.into();
152    }
153
154    pub fn child_rounding(&self) -> f32 {
155        self.0.ChildRounding
156    }
157    pub fn set_child_rounding(&mut self, v: f32) {
158        self.0.ChildRounding = v;
159    }
160
161    pub fn child_border_size(&self) -> f32 {
162        self.0.ChildBorderSize
163    }
164    pub fn set_child_border_size(&mut self, v: f32) {
165        self.0.ChildBorderSize = v;
166    }
167
168    pub fn popup_rounding(&self) -> f32 {
169        self.0.PopupRounding
170    }
171    pub fn set_popup_rounding(&mut self, v: f32) {
172        self.0.PopupRounding = v;
173    }
174
175    pub fn popup_border_size(&self) -> f32 {
176        self.0.PopupBorderSize
177    }
178    pub fn set_popup_border_size(&mut self, v: f32) {
179        self.0.PopupBorderSize = v;
180    }
181
182    pub fn frame_padding(&self) -> [f32; 2] {
183        [self.0.FramePadding.x, self.0.FramePadding.y]
184    }
185    pub fn set_frame_padding(&mut self, v: [f32; 2]) {
186        self.0.FramePadding = sys::ImVec2 { x: v[0], y: v[1] };
187    }
188
189    pub fn frame_rounding(&self) -> f32 {
190        self.0.FrameRounding
191    }
192    pub fn set_frame_rounding(&mut self, v: f32) {
193        self.0.FrameRounding = v;
194    }
195
196    pub fn frame_border_size(&self) -> f32 {
197        self.0.FrameBorderSize
198    }
199    pub fn set_frame_border_size(&mut self, v: f32) {
200        self.0.FrameBorderSize = v;
201    }
202
203    pub fn item_spacing(&self) -> [f32; 2] {
204        [self.0.ItemSpacing.x, self.0.ItemSpacing.y]
205    }
206    pub fn set_item_spacing(&mut self, v: [f32; 2]) {
207        self.0.ItemSpacing = sys::ImVec2 { x: v[0], y: v[1] };
208    }
209
210    pub fn item_inner_spacing(&self) -> [f32; 2] {
211        [self.0.ItemInnerSpacing.x, self.0.ItemInnerSpacing.y]
212    }
213    pub fn set_item_inner_spacing(&mut self, v: [f32; 2]) {
214        self.0.ItemInnerSpacing = sys::ImVec2 { x: v[0], y: v[1] };
215    }
216
217    pub fn cell_padding(&self) -> [f32; 2] {
218        [self.0.CellPadding.x, self.0.CellPadding.y]
219    }
220    pub fn set_cell_padding(&mut self, v: [f32; 2]) {
221        self.0.CellPadding = sys::ImVec2 { x: v[0], y: v[1] };
222    }
223
224    pub fn touch_extra_padding(&self) -> [f32; 2] {
225        [self.0.TouchExtraPadding.x, self.0.TouchExtraPadding.y]
226    }
227    pub fn set_touch_extra_padding(&mut self, v: [f32; 2]) {
228        self.0.TouchExtraPadding = sys::ImVec2 { x: v[0], y: v[1] };
229    }
230
231    pub fn indent_spacing(&self) -> f32 {
232        self.0.IndentSpacing
233    }
234    pub fn set_indent_spacing(&mut self, v: f32) {
235        self.0.IndentSpacing = v;
236    }
237
238    pub fn columns_min_spacing(&self) -> f32 {
239        self.0.ColumnsMinSpacing
240    }
241    pub fn set_columns_min_spacing(&mut self, v: f32) {
242        self.0.ColumnsMinSpacing = v;
243    }
244
245    pub fn scrollbar_size(&self) -> f32 {
246        self.0.ScrollbarSize
247    }
248    pub fn set_scrollbar_size(&mut self, v: f32) {
249        self.0.ScrollbarSize = v;
250    }
251
252    pub fn scrollbar_rounding(&self) -> f32 {
253        self.0.ScrollbarRounding
254    }
255    pub fn set_scrollbar_rounding(&mut self, v: f32) {
256        self.0.ScrollbarRounding = v;
257    }
258
259    pub fn grab_min_size(&self) -> f32 {
260        self.0.GrabMinSize
261    }
262    pub fn set_grab_min_size(&mut self, v: f32) {
263        self.0.GrabMinSize = v;
264    }
265
266    pub fn grab_rounding(&self) -> f32 {
267        self.0.GrabRounding
268    }
269    pub fn set_grab_rounding(&mut self, v: f32) {
270        self.0.GrabRounding = v;
271    }
272
273    pub fn log_slider_deadzone(&self) -> f32 {
274        self.0.LogSliderDeadzone
275    }
276    pub fn set_log_slider_deadzone(&mut self, v: f32) {
277        self.0.LogSliderDeadzone = v;
278    }
279
280    pub fn tab_rounding(&self) -> f32 {
281        self.0.TabRounding
282    }
283    pub fn set_tab_rounding(&mut self, v: f32) {
284        self.0.TabRounding = v;
285    }
286
287    pub fn tab_border_size(&self) -> f32 {
288        self.0.TabBorderSize
289    }
290    pub fn set_tab_border_size(&mut self, v: f32) {
291        self.0.TabBorderSize = v;
292    }
293
294    pub fn color_button_position(&self) -> Direction {
295        Direction::from(self.0.ColorButtonPosition)
296    }
297    pub fn set_color_button_position(&mut self, d: Direction) {
298        self.0.ColorButtonPosition = d.into();
299    }
300
301    pub fn button_text_align(&self) -> [f32; 2] {
302        [self.0.ButtonTextAlign.x, self.0.ButtonTextAlign.y]
303    }
304    pub fn set_button_text_align(&mut self, v: [f32; 2]) {
305        self.0.ButtonTextAlign = sys::ImVec2 { x: v[0], y: v[1] };
306    }
307
308    pub fn selectable_text_align(&self) -> [f32; 2] {
309        [self.0.SelectableTextAlign.x, self.0.SelectableTextAlign.y]
310    }
311    pub fn set_selectable_text_align(&mut self, v: [f32; 2]) {
312        self.0.SelectableTextAlign = sys::ImVec2 { x: v[0], y: v[1] };
313    }
314
315    pub fn display_window_padding(&self) -> [f32; 2] {
316        [self.0.DisplayWindowPadding.x, self.0.DisplayWindowPadding.y]
317    }
318    pub fn set_display_window_padding(&mut self, v: [f32; 2]) {
319        self.0.DisplayWindowPadding = sys::ImVec2 { x: v[0], y: v[1] };
320    }
321
322    pub fn display_safe_area_padding(&self) -> [f32; 2] {
323        [
324            self.0.DisplaySafeAreaPadding.x,
325            self.0.DisplaySafeAreaPadding.y,
326        ]
327    }
328    pub fn set_display_safe_area_padding(&mut self, v: [f32; 2]) {
329        self.0.DisplaySafeAreaPadding = sys::ImVec2 { x: v[0], y: v[1] };
330    }
331
332    pub fn mouse_cursor_scale(&self) -> f32 {
333        self.0.MouseCursorScale
334    }
335    pub fn set_mouse_cursor_scale(&mut self, v: f32) {
336        self.0.MouseCursorScale = v;
337    }
338
339    pub fn anti_aliased_lines(&self) -> bool {
340        self.0.AntiAliasedLines
341    }
342    pub fn set_anti_aliased_lines(&mut self, v: bool) {
343        self.0.AntiAliasedLines = v;
344    }
345
346    pub fn anti_aliased_lines_use_tex(&self) -> bool {
347        self.0.AntiAliasedLinesUseTex
348    }
349    pub fn set_anti_aliased_lines_use_tex(&mut self, v: bool) {
350        self.0.AntiAliasedLinesUseTex = v;
351    }
352
353    pub fn anti_aliased_fill(&self) -> bool {
354        self.0.AntiAliasedFill
355    }
356    pub fn set_anti_aliased_fill(&mut self, v: bool) {
357        self.0.AntiAliasedFill = v;
358    }
359
360    pub fn curve_tessellation_tol(&self) -> f32 {
361        self.0.CurveTessellationTol
362    }
363    pub fn set_curve_tessellation_tol(&mut self, v: f32) {
364        self.0.CurveTessellationTol = v;
365    }
366
367    pub fn circle_tessellation_max_error(&self) -> f32 {
368        self.0.CircleTessellationMaxError
369    }
370    pub fn set_circle_tessellation_max_error(&mut self, v: f32) {
371        self.0.CircleTessellationMaxError = v;
372    }
373
374    // Newly exposed 1.92+ or less-common fields
375
376    pub fn window_border_hover_padding(&self) -> f32 {
377        self.0.WindowBorderHoverPadding
378    }
379    pub fn set_window_border_hover_padding(&mut self, v: f32) {
380        self.0.WindowBorderHoverPadding = v;
381    }
382
383    pub fn scrollbar_padding(&self) -> f32 {
384        self.0.ScrollbarPadding
385    }
386    pub fn set_scrollbar_padding(&mut self, v: f32) {
387        self.0.ScrollbarPadding = v;
388    }
389
390    pub fn image_border_size(&self) -> f32 {
391        self.0.ImageBorderSize
392    }
393    pub fn set_image_border_size(&mut self, v: f32) {
394        self.0.ImageBorderSize = v;
395    }
396
397    pub fn tab_min_width_base(&self) -> f32 {
398        self.0.TabMinWidthBase
399    }
400    pub fn set_tab_min_width_base(&mut self, v: f32) {
401        self.0.TabMinWidthBase = v;
402    }
403
404    pub fn tab_min_width_shrink(&self) -> f32 {
405        self.0.TabMinWidthShrink
406    }
407    pub fn set_tab_min_width_shrink(&mut self, v: f32) {
408        self.0.TabMinWidthShrink = v;
409    }
410
411    pub fn tab_close_button_min_width_selected(&self) -> f32 {
412        self.0.TabCloseButtonMinWidthSelected
413    }
414    pub fn set_tab_close_button_min_width_selected(&mut self, v: f32) {
415        self.0.TabCloseButtonMinWidthSelected = v;
416    }
417
418    pub fn tab_close_button_min_width_unselected(&self) -> f32 {
419        self.0.TabCloseButtonMinWidthUnselected
420    }
421    pub fn set_tab_close_button_min_width_unselected(&mut self, v: f32) {
422        self.0.TabCloseButtonMinWidthUnselected = v;
423    }
424
425    pub fn tab_bar_border_size(&self) -> f32 {
426        self.0.TabBarBorderSize
427    }
428    pub fn set_tab_bar_border_size(&mut self, v: f32) {
429        self.0.TabBarBorderSize = v;
430    }
431
432    pub fn tab_bar_overline_size(&self) -> f32 {
433        self.0.TabBarOverlineSize
434    }
435    pub fn set_tab_bar_overline_size(&mut self, v: f32) {
436        self.0.TabBarOverlineSize = v;
437    }
438
439    pub fn table_angled_headers_angle(&self) -> f32 {
440        self.0.TableAngledHeadersAngle
441    }
442    pub fn set_table_angled_headers_angle(&mut self, v: f32) {
443        self.0.TableAngledHeadersAngle = v;
444    }
445
446    pub fn table_angled_headers_text_align(&self) -> [f32; 2] {
447        [
448            self.0.TableAngledHeadersTextAlign.x,
449            self.0.TableAngledHeadersTextAlign.y,
450        ]
451    }
452    pub fn set_table_angled_headers_text_align(&mut self, v: [f32; 2]) {
453        self.0.TableAngledHeadersTextAlign = sys::ImVec2 { x: v[0], y: v[1] };
454    }
455
456    pub fn tree_lines_flags(&self) -> TreeNodeFlags {
457        TreeNodeFlags::from_bits_truncate(self.0.TreeLinesFlags as i32)
458    }
459    pub fn set_tree_lines_flags(&mut self, flags: TreeNodeFlags) {
460        self.0.TreeLinesFlags = flags.bits() as sys::ImGuiTreeNodeFlags;
461    }
462
463    pub fn tree_lines_size(&self) -> f32 {
464        self.0.TreeLinesSize
465    }
466    pub fn set_tree_lines_size(&mut self, v: f32) {
467        self.0.TreeLinesSize = v;
468    }
469
470    pub fn tree_lines_rounding(&self) -> f32 {
471        self.0.TreeLinesRounding
472    }
473    pub fn set_tree_lines_rounding(&mut self, v: f32) {
474        self.0.TreeLinesRounding = v;
475    }
476
477    pub fn separator_text_border_size(&self) -> f32 {
478        self.0.SeparatorTextBorderSize
479    }
480    pub fn set_separator_text_border_size(&mut self, v: f32) {
481        self.0.SeparatorTextBorderSize = v;
482    }
483
484    pub fn separator_text_align(&self) -> [f32; 2] {
485        [self.0.SeparatorTextAlign.x, self.0.SeparatorTextAlign.y]
486    }
487    pub fn set_separator_text_align(&mut self, v: [f32; 2]) {
488        self.0.SeparatorTextAlign = sys::ImVec2 { x: v[0], y: v[1] };
489    }
490
491    pub fn separator_text_padding(&self) -> [f32; 2] {
492        [self.0.SeparatorTextPadding.x, self.0.SeparatorTextPadding.y]
493    }
494    pub fn set_separator_text_padding(&mut self, v: [f32; 2]) {
495        self.0.SeparatorTextPadding = sys::ImVec2 { x: v[0], y: v[1] };
496    }
497
498    pub fn docking_node_has_close_button(&self) -> bool {
499        self.0.DockingNodeHasCloseButton
500    }
501    pub fn set_docking_node_has_close_button(&mut self, v: bool) {
502        self.0.DockingNodeHasCloseButton = v;
503    }
504
505    pub fn docking_separator_size(&self) -> f32 {
506        self.0.DockingSeparatorSize
507    }
508    pub fn set_docking_separator_size(&mut self, v: f32) {
509        self.0.DockingSeparatorSize = v;
510    }
511
512    pub fn hover_stationary_delay(&self) -> f32 {
513        self.0.HoverStationaryDelay
514    }
515    pub fn set_hover_stationary_delay(&mut self, v: f32) {
516        self.0.HoverStationaryDelay = v;
517    }
518
519    pub fn hover_delay_short(&self) -> f32 {
520        self.0.HoverDelayShort
521    }
522    pub fn set_hover_delay_short(&mut self, v: f32) {
523        self.0.HoverDelayShort = v;
524    }
525
526    pub fn hover_delay_normal(&self) -> f32 {
527        self.0.HoverDelayNormal
528    }
529    pub fn set_hover_delay_normal(&mut self, v: f32) {
530        self.0.HoverDelayNormal = v;
531    }
532
533    pub fn hover_flags_for_tooltip_mouse(&self) -> HoveredFlags {
534        HoveredFlags::from_bits_truncate(self.0.HoverFlagsForTooltipMouse as i32)
535    }
536    pub fn set_hover_flags_for_tooltip_mouse(&mut self, flags: HoveredFlags) {
537        self.0.HoverFlagsForTooltipMouse = flags.bits() as sys::ImGuiHoveredFlags;
538    }
539
540    pub fn hover_flags_for_tooltip_nav(&self) -> HoveredFlags {
541        HoveredFlags::from_bits_truncate(self.0.HoverFlagsForTooltipNav as i32)
542    }
543    pub fn set_hover_flags_for_tooltip_nav(&mut self, flags: HoveredFlags) {
544        self.0.HoverFlagsForTooltipNav = flags.bits() as sys::ImGuiHoveredFlags;
545    }
546}
547
548// HoveredFlags are defined in utils.rs and re-exported at crate root.
549
550/// A cardinal direction
551#[repr(i32)]
552#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
553pub enum Direction {
554    None = sys::ImGuiDir_None as i32,
555    Left = sys::ImGuiDir_Left as i32,
556    Right = sys::ImGuiDir_Right as i32,
557    Up = sys::ImGuiDir_Up as i32,
558    Down = sys::ImGuiDir_Down as i32,
559}
560
561impl From<sys::ImGuiDir> for Direction {
562    fn from(d: sys::ImGuiDir) -> Self {
563        match d as i32 {
564            x if x == sys::ImGuiDir_Left as i32 => Direction::Left,
565            x if x == sys::ImGuiDir_Right as i32 => Direction::Right,
566            x if x == sys::ImGuiDir_Up as i32 => Direction::Up,
567            x if x == sys::ImGuiDir_Down as i32 => Direction::Down,
568            _ => Direction::None,
569        }
570    }
571}
572
573impl From<Direction> for sys::ImGuiDir {
574    fn from(d: Direction) -> Self {
575        match d {
576            Direction::None => sys::ImGuiDir_None,
577            Direction::Left => sys::ImGuiDir_Left,
578            Direction::Right => sys::ImGuiDir_Right,
579            Direction::Up => sys::ImGuiDir_Up,
580            Direction::Down => sys::ImGuiDir_Down,
581        }
582    }
583}
584
585/// Style color identifier
586#[repr(i32)]
587#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
588pub enum StyleColor {
589    Text = sys::ImGuiCol_Text as i32,
590    TextDisabled = sys::ImGuiCol_TextDisabled as i32,
591    WindowBg = sys::ImGuiCol_WindowBg as i32,
592    ChildBg = sys::ImGuiCol_ChildBg as i32,
593    PopupBg = sys::ImGuiCol_PopupBg as i32,
594    Border = sys::ImGuiCol_Border as i32,
595    BorderShadow = sys::ImGuiCol_BorderShadow as i32,
596    FrameBg = sys::ImGuiCol_FrameBg as i32,
597    FrameBgHovered = sys::ImGuiCol_FrameBgHovered as i32,
598    FrameBgActive = sys::ImGuiCol_FrameBgActive as i32,
599    TitleBg = sys::ImGuiCol_TitleBg as i32,
600    TitleBgActive = sys::ImGuiCol_TitleBgActive as i32,
601    TitleBgCollapsed = sys::ImGuiCol_TitleBgCollapsed as i32,
602    MenuBarBg = sys::ImGuiCol_MenuBarBg as i32,
603    ScrollbarBg = sys::ImGuiCol_ScrollbarBg as i32,
604    ScrollbarGrab = sys::ImGuiCol_ScrollbarGrab as i32,
605    ScrollbarGrabHovered = sys::ImGuiCol_ScrollbarGrabHovered as i32,
606    ScrollbarGrabActive = sys::ImGuiCol_ScrollbarGrabActive as i32,
607    CheckMark = sys::ImGuiCol_CheckMark as i32,
608    SliderGrab = sys::ImGuiCol_SliderGrab as i32,
609    SliderGrabActive = sys::ImGuiCol_SliderGrabActive as i32,
610    Button = sys::ImGuiCol_Button as i32,
611    ButtonHovered = sys::ImGuiCol_ButtonHovered as i32,
612    ButtonActive = sys::ImGuiCol_ButtonActive as i32,
613    Header = sys::ImGuiCol_Header as i32,
614    HeaderHovered = sys::ImGuiCol_HeaderHovered as i32,
615    HeaderActive = sys::ImGuiCol_HeaderActive as i32,
616    Separator = sys::ImGuiCol_Separator as i32,
617    SeparatorHovered = sys::ImGuiCol_SeparatorHovered as i32,
618    SeparatorActive = sys::ImGuiCol_SeparatorActive as i32,
619    ResizeGrip = sys::ImGuiCol_ResizeGrip as i32,
620    ResizeGripHovered = sys::ImGuiCol_ResizeGripHovered as i32,
621    ResizeGripActive = sys::ImGuiCol_ResizeGripActive as i32,
622    Tab = sys::ImGuiCol_Tab as i32,
623    TabHovered = sys::ImGuiCol_TabHovered as i32,
624    // Newly added tab colors in docking branch
625    TabSelected = sys::ImGuiCol_TabSelected as i32,
626    TabSelectedOverline = sys::ImGuiCol_TabSelectedOverline as i32,
627    TabDimmed = sys::ImGuiCol_TabDimmed as i32,
628    TabDimmedSelected = sys::ImGuiCol_TabDimmedSelected as i32,
629    TabDimmedSelectedOverline = sys::ImGuiCol_TabDimmedSelectedOverline as i32,
630    DockingPreview = sys::ImGuiCol_DockingPreview as i32,
631    DockingEmptyBg = sys::ImGuiCol_DockingEmptyBg as i32,
632    PlotLines = sys::ImGuiCol_PlotLines as i32,
633    PlotLinesHovered = sys::ImGuiCol_PlotLinesHovered as i32,
634    PlotHistogram = sys::ImGuiCol_PlotHistogram as i32,
635    PlotHistogramHovered = sys::ImGuiCol_PlotHistogramHovered as i32,
636    TableHeaderBg = sys::ImGuiCol_TableHeaderBg as i32,
637    TableBorderStrong = sys::ImGuiCol_TableBorderStrong as i32,
638    TableBorderLight = sys::ImGuiCol_TableBorderLight as i32,
639    TableRowBg = sys::ImGuiCol_TableRowBg as i32,
640    TableRowBgAlt = sys::ImGuiCol_TableRowBgAlt as i32,
641    TextSelectedBg = sys::ImGuiCol_TextSelectedBg as i32,
642    TextLink = sys::ImGuiCol_TextLink as i32,
643    TreeLines = sys::ImGuiCol_TreeLines as i32,
644    InputTextCursor = sys::ImGuiCol_InputTextCursor as i32,
645    DragDropTarget = sys::ImGuiCol_DragDropTarget as i32,
646    DragDropTargetBg = sys::ImGuiCol_DragDropTargetBg as i32,
647    UnsavedMarker = sys::ImGuiCol_UnsavedMarker as i32,
648    NavCursor = sys::ImGuiCol_NavCursor as i32,
649    NavWindowingHighlight = sys::ImGuiCol_NavWindowingHighlight as i32,
650    NavWindowingDimBg = sys::ImGuiCol_NavWindowingDimBg as i32,
651    ModalWindowDimBg = sys::ImGuiCol_ModalWindowDimBg as i32,
652}
653
654impl StyleColor {
655    pub const COUNT: usize = sys::ImGuiCol_COUNT as usize;
656}
657
658impl RawWrapper for Style {
659    type Raw = sys::ImGuiStyle;
660
661    unsafe fn raw(&self) -> &Self::Raw {
662        &self.0
663    }
664
665    unsafe fn raw_mut(&mut self) -> &mut Self::Raw {
666        &mut self.0
667    }
668}
669
670/// A temporary change in user interface style
671#[derive(Copy, Clone, Debug, PartialEq)]
672#[non_exhaustive]
673pub enum StyleVar {
674    /// Global alpha applies to everything
675    Alpha(f32),
676    /// Additional alpha multiplier applied to disabled elements
677    DisabledAlpha(f32),
678    /// Padding within a window
679    WindowPadding([f32; 2]),
680    /// Rounding radius of window corners
681    WindowRounding(f32),
682    /// Thickness of border around windows
683    WindowBorderSize(f32),
684    /// Minimum window size
685    WindowMinSize([f32; 2]),
686    /// Alignment for title bar text
687    WindowTitleAlign([f32; 2]),
688    /// Rounding radius of child window corners
689    ChildRounding(f32),
690    /// Thickness of border around child windows
691    ChildBorderSize(f32),
692    /// Rounding radius of popup window corners
693    PopupRounding(f32),
694    /// Thickness of border around popup/tooltip windows
695    PopupBorderSize(f32),
696    /// Padding within a framed rectangle (used by most widgets)
697    FramePadding([f32; 2]),
698    /// Rounding radius of frame corners (used by most widgets)
699    FrameRounding(f32),
700    /// Thickness of border around frames
701    FrameBorderSize(f32),
702    /// Horizontal and vertical spacing between widgets/lines
703    ItemSpacing([f32; 2]),
704    /// Horizontal and vertical spacing between within elements of a composed widget
705    ItemInnerSpacing([f32; 2]),
706    /// Horizontal indentation when e.g. entering a tree node
707    IndentSpacing(f32),
708    /// Padding within a table cell
709    CellPadding([f32; 2]),
710    /// Width of the vertical scrollbar, height of the horizontal scrollbar
711    ScrollbarSize(f32),
712    /// Rounding radius of scrollbar corners
713    ScrollbarRounding(f32),
714    /// Minimum width/height of a grab box for slider/scrollbar
715    GrabMinSize(f32),
716    /// Rounding radius of grabs corners
717    GrabRounding(f32),
718    /// Rounding radius of upper corners of tabs
719    TabRounding(f32),
720    /// Alignment of button text when button is larger than text
721    ButtonTextAlign([f32; 2]),
722    /// Alignment of selectable text when selectable is larger than text
723    SelectableTextAlign([f32; 2]),
724}