arcdps_imgui\widget/
color_editors.rs

1use bitflags::bitflags;
2use std::ptr;
3
4use crate::sys;
5use crate::Ui;
6
7/// Mutable reference to an editable color value.
8#[derive(Debug)]
9pub enum EditableColor<'a> {
10    /// Color value with three float components (e.g. RGB).
11    Float3(&'a mut [f32; 3]),
12    /// Color value with four float components (e.g. RGBA).
13    Float4(&'a mut [f32; 4]),
14}
15
16impl<'a> EditableColor<'a> {
17    /// Returns an unsafe mutable pointer to the color slice's buffer.
18    fn as_mut_ptr(&mut self) -> *mut f32 {
19        match *self {
20            EditableColor::Float3(ref mut value) => value.as_mut_ptr(),
21            EditableColor::Float4(ref mut value) => value.as_mut_ptr(),
22        }
23    }
24}
25
26impl<'a> From<&'a mut [f32; 3]> for EditableColor<'a> {
27    #[inline]
28    fn from(value: &'a mut [f32; 3]) -> EditableColor<'a> {
29        EditableColor::Float3(value)
30    }
31}
32
33impl<'a> From<&'a mut [f32; 4]> for EditableColor<'a> {
34    #[inline]
35    fn from(value: &'a mut [f32; 4]) -> EditableColor<'a> {
36        EditableColor::Float4(value)
37    }
38}
39
40/// Color editor input mode.
41#[derive(Copy, Clone, Debug, PartialEq, Eq)]
42pub enum ColorEditInputMode {
43    /// Edit as RGB(A).
44    Rgb,
45    /// Edit as HSV(A).
46    Hsv,
47}
48
49impl ColorEditInputMode {
50    // Note: Probably no point in deprecating these since they're ~0 maintance burden.
51    /// Edit as RGB(A). Alias for [`Self::Rgb`] for backwards-compatibility.
52    pub const RGB: Self = Self::Rgb;
53    /// Edit as HSV(A). Alias for [`Self::Hsv`] for backwards-compatibility.
54    pub const HSV: Self = Self::Hsv;
55}
56
57/// Color editor display mode.
58#[derive(Copy, Clone, Debug, PartialEq, Eq)]
59pub enum ColorEditDisplayMode {
60    /// Display as RGB(A).
61    Rgb,
62    /// Display as HSV(A).
63    Hsv,
64    /// Display as hex (e.g. `#AABBCC(DD)`)
65    Hex,
66}
67
68impl ColorEditDisplayMode {
69    // Note: Probably no point in deprecating these since they're ~0 maintance burden.
70    /// Display as RGB(A). Alias for [`Self::Rgb`] for backwards-compatibility.
71    pub const RGB: Self = Self::Rgb;
72    /// Display as HSV(A). Alias for [`Self::Hsv`] for backwards-compatibility.
73    pub const HSV: Self = Self::Hsv;
74    /// Display as hex. Alias for [`Self::Hex`] for backwards-compatibility.
75    pub const HEX: Self = Self::Hex;
76}
77
78/// Color picker hue/saturation/value editor mode
79#[derive(Copy, Clone, Debug, PartialEq, Eq)]
80pub enum ColorPickerMode {
81    /// Use a bar for hue, rectangle for saturation/value.
82    HueBar,
83    /// Use a wheel for hue, triangle for saturation/value.
84    HueWheel,
85}
86
87/// Color component formatting
88#[derive(Copy, Clone, Debug, PartialEq, Eq)]
89pub enum ColorFormat {
90    /// Display values formatted as 0..255.
91    U8,
92    /// Display values formatted as 0.0..1.0.
93    Float,
94}
95
96/// Color editor preview style
97#[derive(Copy, Clone, Debug, PartialEq, Eq)]
98pub enum ColorPreview {
99    /// Don't show the alpha component.
100    Opaque,
101    /// Half of the preview area shows the alpha component using a checkerboard pattern.
102    HalfAlpha,
103    /// Show the alpha component using a checkerboard pattern.
104    Alpha,
105}
106
107bitflags! {
108    /// Color edit flags
109    #[repr(transparent)]
110    pub struct ColorEditFlags: u32 {
111        /// ColorEdit, ColorPicker, ColorButton: ignore Alpha component (read only 3 components of
112        /// the value).
113        const NO_ALPHA = sys::ImGuiColorEditFlags_NoAlpha;
114        /// ColorEdit: disable picker when clicking on colored square.
115        const NO_PICKER = sys::ImGuiColorEditFlags_NoPicker;
116        /// ColorEdit: disable toggling options menu when right-clicking on inputs/small preview.
117        const NO_OPTIONS = sys::ImGuiColorEditFlags_NoOptions;
118        /// ColorEdit, ColorPicker: disable colored square preview next to the inputs. (e.g. to
119        /// show only the inputs)
120        const NO_SMALL_PREVIEW = sys::ImGuiColorEditFlags_NoSmallPreview;
121        /// ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the
122        /// small preview colored square).
123        const NO_INPUTS = sys::ImGuiColorEditFlags_NoInputs;
124        /// ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview.
125        const NO_TOOLTIP = sys::ImGuiColorEditFlags_NoTooltip;
126        /// ColorEdit, ColorPicker: disable display of inline text label (the label is still
127        /// forwarded to the tooltip and picker).
128        const NO_LABEL = sys::ImGuiColorEditFlags_NoLabel;
129        /// ColorPicker: disable bigger color preview on right side of the picker, use small
130        /// colored square preview instead.
131        const NO_SIDE_PREVIEW = sys::ImGuiColorEditFlags_NoSidePreview;
132        /// ColorEdit: disable drag and drop target. ColorButton: disable drag and drop source.
133        const NO_DRAG_DROP = sys::ImGuiColorEditFlags_NoDragDrop;
134        /// ColorButton: disable border (which is enforced by default).
135        const NO_BORDER = sys::ImGuiColorEditFlags_NoBorder;
136
137        /// ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker.
138        const ALPHA_BAR = sys::ImGuiColorEditFlags_AlphaBar;
139        /// ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a
140        /// checkerboard, instead of opaque.
141        const ALPHA_PREVIEW = sys::ImGuiColorEditFlags_AlphaPreview;
142        /// ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead
143        /// of opaque.
144        const ALPHA_PREVIEW_HALF = sys::ImGuiColorEditFlags_AlphaPreviewHalf;
145        /// (WIP) ColorEdit: Currently onlys disable 0.0f..1.0f limits in RGBA editing (note: you
146        /// probably want to use `ColorEditFlags::FLOAT` as well).
147        const HDR = sys::ImGuiColorEditFlags_HDR;
148        /// ColorEdit: display only as RGB. ColorPicker: Enable RGB display.
149        const DISPLAY_RGB = sys::ImGuiColorEditFlags_DisplayRGB;
150        /// ColorEdit: display only as HSV. ColorPicker: Enable HSV display.
151        const DISPLAY_HSV = sys::ImGuiColorEditFlags_DisplayHSV;
152        /// ColorEdit: display only as HEX. ColorPicker: Enable Hex display.
153        const DISPLAY_HEX = sys::ImGuiColorEditFlags_DisplayHex;
154        /// ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255.
155        const UINT8 = sys::ImGuiColorEditFlags_Uint8;
156        /// ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0.0f..1.0f floats
157        /// instead of 0..255 integers. No round-trip of value via integers.
158        const FLOAT = sys::ImGuiColorEditFlags_Float;
159        /// ColorPicker: bar for Hue, rectangle for Sat/Value.
160        const PICKER_HUE_BAR = sys::ImGuiColorEditFlags_PickerHueBar;
161        /// ColorPicker: wheel for Hue, triangle for Sat/Value.
162        const PICKER_HUE_WHEEL = sys::ImGuiColorEditFlags_PickerHueWheel;
163        /// ColorEdit, ColorPicker: input and output data in RGB format.
164        const INPUT_RGB = sys::ImGuiColorEditFlags_InputRGB;
165        /// ColorEdit, ColorPicker: input and output data in HSV format.
166        const INPUT_HSV = sys::ImGuiColorEditFlags_InputHSV;
167    }
168}
169
170/// Builder for a color editor widget.
171///
172/// # Examples
173///
174/// ```no_run
175/// # use arcdps_imgui::*;
176/// # let mut imgui = Context::create();
177/// # let ui = imgui.frame();
178/// # let mut color = [0.0, 0.0, 0.0, 1.0];
179/// let ce = ColorEdit::new(im_str!("color_edit"), &mut color);
180/// if ce.build(&ui) {
181///   println!("The color was changed");
182/// }
183/// ```
184#[derive(Debug)]
185#[must_use]
186pub struct ColorEdit<'a, T: AsRef<str> + 'a> {
187    label: T,
188    value: EditableColor<'a>,
189    flags: ColorEditFlags,
190}
191
192impl<'a, T: AsRef<str> + 'a> ColorEdit<'a, T> {
193    /// Constructs a new color editor builder.
194    #[doc(alias = "ColorEdit3", alias = "ColorEdit4")]
195    pub fn new(label: T, value: impl Into<EditableColor<'a>>) -> ColorEdit<'a, T> {
196        ColorEdit {
197            label,
198            value: value.into(),
199            flags: ColorEditFlags::empty(),
200        }
201    }
202    /// Replaces all current settings with the given flags.
203    #[inline]
204    pub fn flags(mut self, flags: ColorEditFlags) -> Self {
205        self.flags = flags;
206        self
207    }
208    /// Enables/disables the use of the alpha component.
209    #[inline]
210    pub fn alpha(mut self, value: bool) -> Self {
211        self.flags.set(ColorEditFlags::NO_ALPHA, !value);
212        self
213    }
214    /// Enables/disables the picker that appears when clicking on colored square.
215    #[inline]
216    pub fn picker(mut self, value: bool) -> Self {
217        self.flags.set(ColorEditFlags::NO_PICKER, !value);
218        self
219    }
220    /// Enables/disables toggling of the options menu when right-clicking on inputs or the small
221    /// preview.
222    #[inline]
223    pub fn options(mut self, value: bool) -> Self {
224        self.flags.set(ColorEditFlags::NO_OPTIONS, !value);
225        self
226    }
227    /// Enables/disables the colored square preview next to the inputs.
228    #[inline]
229    pub fn small_preview(mut self, value: bool) -> Self {
230        self.flags.set(ColorEditFlags::NO_SMALL_PREVIEW, !value);
231        self
232    }
233    /// Enables/disables the input sliders/text widgets.
234    #[inline]
235    pub fn inputs(mut self, value: bool) -> Self {
236        self.flags.set(ColorEditFlags::NO_INPUTS, !value);
237        self
238    }
239    /// Enables/disables the tooltip that appears when hovering the preview.
240    #[inline]
241    pub fn tooltip(mut self, value: bool) -> Self {
242        self.flags.set(ColorEditFlags::NO_TOOLTIP, !value);
243        self
244    }
245    /// Enables/disables display of the inline text label (the label is in any case forwarded to
246    /// the tooltip and picker).
247    #[inline]
248    pub fn label(mut self, value: bool) -> Self {
249        self.flags.set(ColorEditFlags::NO_LABEL, !value);
250        self
251    }
252    /// Enables/disables the vertical alpha bar/gradient in the color picker.
253    #[inline]
254    pub fn alpha_bar(mut self, value: bool) -> Self {
255        self.flags.set(ColorEditFlags::ALPHA_BAR, value);
256        self
257    }
258    /// Sets the preview style.
259    #[inline]
260    pub fn preview(mut self, preview: ColorPreview) -> Self {
261        self.flags.set(
262            ColorEditFlags::ALPHA_PREVIEW_HALF,
263            preview == ColorPreview::HalfAlpha,
264        );
265        self.flags.set(
266            ColorEditFlags::ALPHA_PREVIEW,
267            preview == ColorPreview::Alpha,
268        );
269        self
270    }
271    /// (WIP) Currently only disables 0.0..1.0 limits in RGBA edition.
272    ///
273    /// Note: you probably want to use ColorFormat::Float as well.
274    #[inline]
275    pub fn hdr(mut self, value: bool) -> Self {
276        self.flags.set(ColorEditFlags::HDR, value);
277        self
278    }
279    /// Sets the data format for input and output data.
280    #[inline]
281    pub fn input_mode(mut self, input_mode: ColorEditInputMode) -> Self {
282        self.flags.set(
283            ColorEditFlags::INPUT_RGB,
284            input_mode == ColorEditInputMode::RGB,
285        );
286        self.flags.set(
287            ColorEditFlags::INPUT_HSV,
288            input_mode == ColorEditInputMode::HSV,
289        );
290        self
291    }
292    /// Sets the color editor display mode.
293    #[inline]
294    pub fn display_mode(mut self, mode: ColorEditDisplayMode) -> Self {
295        self.flags.set(
296            ColorEditFlags::DISPLAY_RGB,
297            mode == ColorEditDisplayMode::RGB,
298        );
299        self.flags.set(
300            ColorEditFlags::DISPLAY_HSV,
301            mode == ColorEditDisplayMode::HSV,
302        );
303        self.flags.set(
304            ColorEditFlags::DISPLAY_HEX,
305            mode == ColorEditDisplayMode::HEX,
306        );
307        self
308    }
309    /// Sets the formatting style of color components.
310    #[inline]
311    pub fn format(mut self, format: ColorFormat) -> Self {
312        self.flags
313            .set(ColorEditFlags::UINT8, format == ColorFormat::U8);
314        self.flags
315            .set(ColorEditFlags::FLOAT, format == ColorFormat::Float);
316        self
317    }
318    /// Builds the color editor.
319    ///
320    /// Returns true if the color value was changed.
321    pub fn build(mut self, ui: &Ui<'_>) -> bool {
322        if let EditableColor::Float3(_) = self.value {
323            self.flags.insert(ColorEditFlags::NO_ALPHA);
324        }
325        match self.value {
326            EditableColor::Float3(value) => unsafe {
327                sys::igColorEdit3(
328                    ui.scratch_txt(self.label),
329                    value.as_mut_ptr(),
330                    self.flags.bits() as _,
331                )
332            },
333            EditableColor::Float4(value) => unsafe {
334                sys::igColorEdit4(
335                    ui.scratch_txt(self.label),
336                    value.as_mut_ptr(),
337                    self.flags.bits() as _,
338                )
339            },
340        }
341    }
342}
343
344/// Builder for a color picker widget.
345///
346/// # Examples
347///
348/// ```no_run
349/// # use arcdps_imgui::*;
350/// # let mut imgui = Context::create();
351/// # let ui = imgui.frame();
352/// # let mut color = [0.0, 0.0, 0.0, 1.0];
353/// let cp = ColorPicker::new(im_str!("color_picker"), &mut color);
354/// if cp.build(&ui) {
355///   println!("A color was picked");
356/// }
357/// ```
358#[derive(Debug)]
359#[must_use]
360pub struct ColorPicker<'a, T: AsRef<str> + 'a> {
361    label: T,
362    value: EditableColor<'a>,
363    flags: ColorEditFlags,
364    ref_color: Option<&'a [f32; 4]>,
365}
366
367impl<'a, T: AsRef<str>> ColorPicker<'a, T> {
368    /// Constructs a new color picker builder.
369    #[doc(alias = "ColorButton")]
370    pub fn new(label: T, value: impl Into<EditableColor<'a>>) -> Self {
371        ColorPicker {
372            label,
373            value: value.into(),
374            flags: ColorEditFlags::empty(),
375            ref_color: None,
376        }
377    }
378    /// Replaces all current settings with the given flags.
379    #[inline]
380    pub fn flags(mut self, flags: ColorEditFlags) -> Self {
381        self.flags = flags;
382        self
383    }
384    /// Enables/disables the use of the alpha component.
385    #[inline]
386    pub fn alpha(mut self, value: bool) -> Self {
387        self.flags.set(ColorEditFlags::NO_ALPHA, !value);
388        self
389    }
390    /// Enables/disables toggling of the options menu when right-clicking on inputs or the small
391    /// preview.
392    #[inline]
393    pub fn options(mut self, value: bool) -> Self {
394        self.flags.set(ColorEditFlags::NO_OPTIONS, !value);
395        self
396    }
397    /// Enables/disables the colored square preview next to the inputs.
398    #[inline]
399    pub fn small_preview(mut self, value: bool) -> Self {
400        self.flags.set(ColorEditFlags::NO_SMALL_PREVIEW, !value);
401        self
402    }
403    /// Enables/disables the input sliders/text widgets.
404    #[inline]
405    pub fn inputs(mut self, value: bool) -> Self {
406        self.flags.set(ColorEditFlags::NO_INPUTS, !value);
407        self
408    }
409    /// Enables/disables the tooltip that appears when hovering the preview.
410    #[inline]
411    pub fn tooltip(mut self, value: bool) -> Self {
412        self.flags.set(ColorEditFlags::NO_TOOLTIP, !value);
413        self
414    }
415    /// Enables/disables display of the inline text label (the label is in any case forwarded to
416    /// the tooltip and picker).
417    #[inline]
418    pub fn label(mut self, value: bool) -> Self {
419        self.flags.set(ColorEditFlags::NO_LABEL, !value);
420        self
421    }
422    /// Enables/disables the bigger color preview on the right side of the picker.
423    #[inline]
424    pub fn side_preview(mut self, value: bool) -> Self {
425        self.flags.set(ColorEditFlags::NO_SIDE_PREVIEW, !value);
426        self
427    }
428    /// Enables/disables the vertical alpha bar/gradient in the color picker.
429    #[inline]
430    pub fn alpha_bar(mut self, value: bool) -> Self {
431        self.flags.set(ColorEditFlags::ALPHA_BAR, value);
432        self
433    }
434    /// Sets the preview style.
435    #[inline]
436    pub fn preview(mut self, preview: ColorPreview) -> Self {
437        self.flags.set(
438            ColorEditFlags::ALPHA_PREVIEW_HALF,
439            preview == ColorPreview::HalfAlpha,
440        );
441        self.flags.set(
442            ColorEditFlags::ALPHA_PREVIEW,
443            preview == ColorPreview::Alpha,
444        );
445        self
446    }
447    /// Sets the data format for input and output data.
448    #[inline]
449    pub fn input_mode(mut self, input_mode: ColorEditInputMode) -> Self {
450        self.flags.set(
451            ColorEditFlags::INPUT_RGB,
452            input_mode == ColorEditInputMode::RGB,
453        );
454        self.flags.set(
455            ColorEditFlags::INPUT_HSV,
456            input_mode == ColorEditInputMode::HSV,
457        );
458        self
459    }
460    /// Enables/disables displaying the value as RGB.
461    #[inline]
462    pub fn display_rgb(mut self, value: bool) -> Self {
463        self.flags.set(ColorEditFlags::DISPLAY_RGB, value);
464        self
465    }
466    /// Enables/disables displaying the value as HSV.
467    #[inline]
468    pub fn display_hsv(mut self, value: bool) -> Self {
469        self.flags.set(ColorEditFlags::DISPLAY_HSV, value);
470        self
471    }
472    /// Enables/disables displaying the value as hex.
473    #[inline]
474    pub fn display_hex(mut self, value: bool) -> Self {
475        self.flags.set(ColorEditFlags::DISPLAY_HEX, value);
476        self
477    }
478    /// Sets the hue/saturation/value editor mode.
479    #[inline]
480    pub fn mode(mut self, mode: ColorPickerMode) -> Self {
481        self.flags.set(
482            ColorEditFlags::PICKER_HUE_BAR,
483            mode == ColorPickerMode::HueBar,
484        );
485        self.flags.set(
486            ColorEditFlags::PICKER_HUE_WHEEL,
487            mode == ColorPickerMode::HueWheel,
488        );
489        self
490    }
491    /// Sets the formatting style of color components.
492    #[inline]
493    pub fn format(mut self, format: ColorFormat) -> Self {
494        self.flags
495            .set(ColorEditFlags::UINT8, format == ColorFormat::U8);
496        self.flags
497            .set(ColorEditFlags::FLOAT, format == ColorFormat::Float);
498        self
499    }
500    /// Sets the shown reference color.
501    #[inline]
502    pub fn reference_color(mut self, ref_color: &'a [f32; 4]) -> Self {
503        self.ref_color = Some(ref_color);
504        self
505    }
506    /// Builds the color picker.
507    ///
508    /// Returns true if the color value was changed.
509    pub fn build(mut self, ui: &Ui<'_>) -> bool {
510        if let EditableColor::Float3(_) = self.value {
511            self.flags.insert(ColorEditFlags::NO_ALPHA);
512        }
513        let ref_color = self.ref_color.map(|c| c.as_ptr()).unwrap_or(ptr::null());
514        unsafe {
515            sys::igColorPicker4(
516                ui.scratch_txt(self.label),
517                self.value.as_mut_ptr(),
518                self.flags.bits() as _,
519                ref_color,
520            )
521        }
522    }
523}
524
525/// Builder for a color button widget.
526///
527/// # Examples
528///
529/// ```no_run
530/// # use arcdps_imgui::*;
531/// # let mut imgui = Context::create();
532/// # let ui = imgui.frame();
533/// ColorButton::new(im_str!("color_button"), [1.0, 0.0, 0.0, 1.0])
534///     .build(&ui);
535/// ```
536#[derive(Copy, Clone, Debug)]
537#[must_use]
538pub struct ColorButton<T> {
539    desc_id: T,
540    color: [f32; 4],
541    flags: ColorEditFlags,
542    size: [f32; 2],
543}
544
545impl<T: AsRef<str>> ColorButton<T> {
546    /// Constructs a new color button builder.
547    pub fn new(desc_id: T, color: [f32; 4]) -> Self {
548        ColorButton {
549            desc_id,
550            color,
551            flags: ColorEditFlags::empty(),
552            size: [0.0, 0.0],
553        }
554    }
555    /// Replaces all current settings with the given flags.
556    #[inline]
557    pub fn flags(mut self, flags: ColorEditFlags) -> Self {
558        self.flags = flags;
559        self
560    }
561    /// Enables/disables the use of the alpha component.
562    #[inline]
563    pub fn alpha(mut self, value: bool) -> Self {
564        self.flags.set(ColorEditFlags::NO_ALPHA, !value);
565        self
566    }
567    /// Enables/disables the tooltip that appears when hovering the preview.
568    #[inline]
569    pub fn tooltip(mut self, value: bool) -> Self {
570        self.flags.set(ColorEditFlags::NO_TOOLTIP, !value);
571        self
572    }
573    /// Sets the preview style.
574    #[inline]
575    pub fn preview(mut self, preview: ColorPreview) -> Self {
576        self.flags.set(
577            ColorEditFlags::ALPHA_PREVIEW_HALF,
578            preview == ColorPreview::HalfAlpha,
579        );
580        self.flags.set(
581            ColorEditFlags::ALPHA_PREVIEW,
582            preview == ColorPreview::Alpha,
583        );
584        self
585    }
586    /// Sets the data format for input data.
587    #[inline]
588    pub fn input_mode(mut self, input_mode: ColorEditInputMode) -> Self {
589        self.flags.set(
590            ColorEditFlags::INPUT_RGB,
591            input_mode == ColorEditInputMode::RGB,
592        );
593        self.flags.set(
594            ColorEditFlags::INPUT_HSV,
595            input_mode == ColorEditInputMode::HSV,
596        );
597        self
598    }
599    /// Enables/disables using the button as drag&drop source.
600    ///
601    /// Enabled by default.
602    pub fn drag_drop(mut self, value: bool) -> Self {
603        self.flags.set(ColorEditFlags::NO_DRAG_DROP, !value);
604        self
605    }
606    /// Enables/disables the button border.
607    ///
608    /// Enabled by default.
609    pub fn border(mut self, value: bool) -> Self {
610        self.flags.set(ColorEditFlags::NO_BORDER, !value);
611        self
612    }
613    /// Sets the button size.
614    ///
615    /// Use 0.0 for width and/or height to use the default size.
616    #[inline]
617    pub fn size(mut self, size: [f32; 2]) -> Self {
618        self.size = size;
619        self
620    }
621    /// Builds the color button.
622    ///
623    /// Returns true if this color button was clicked.
624    pub fn build(self, ui: &Ui<'_>) -> bool {
625        unsafe {
626            sys::igColorButton(
627                ui.scratch_txt(self.desc_id),
628                self.color.into(),
629                self.flags.bits() as _,
630                self.size.into(),
631            )
632        }
633    }
634}
635
636/// # Widgets: Color Editor/Picker
637impl<'ui> Ui<'ui> {
638    /// Initializes current color editor/picker options (generally on application startup) if you
639    /// want to select a default format, picker type, etc. Users will be able to change many
640    /// settings, unless you use .options(false) in your widget builders.
641    #[doc(alias = "SetColorEditOptions")]
642    pub fn set_color_edit_options(&self, flags: ColorEditFlags) {
643        unsafe {
644            sys::igSetColorEditOptions(flags.bits() as i32);
645        }
646    }
647}