pub struct ColorPicker<'a, T: AsRef<str> + 'a> { /* private fields */ }
Expand description
Builder for a color picker widget.
§Examples
let cp = ColorPicker::new(im_str!("color_picker"), &mut color);
if cp.build(&ui) {
println!("A color was picked");
}
Implementations§
Source§impl<'a, T: AsRef<str>> ColorPicker<'a, T>
impl<'a, T: AsRef<str>> ColorPicker<'a, T>
Sourcepub fn new(label: T, value: impl Into<EditableColor<'a>>) -> Self
pub fn new(label: T, value: impl Into<EditableColor<'a>>) -> Self
Constructs a new color picker builder.
Sourcepub fn flags(self, flags: ColorEditFlags) -> Self
pub fn flags(self, flags: ColorEditFlags) -> Self
Replaces all current settings with the given flags.
Sourcepub fn options(self, value: bool) -> Self
pub fn options(self, value: bool) -> Self
Enables/disables toggling of the options menu when right-clicking on inputs or the small preview.
Sourcepub fn small_preview(self, value: bool) -> Self
pub fn small_preview(self, value: bool) -> Self
Enables/disables the colored square preview next to the inputs.
Sourcepub fn tooltip(self, value: bool) -> Self
pub fn tooltip(self, value: bool) -> Self
Enables/disables the tooltip that appears when hovering the preview.
Sourcepub fn label(self, value: bool) -> Self
pub fn label(self, value: bool) -> Self
Enables/disables display of the inline text label (the label is in any case forwarded to the tooltip and picker).
Sourcepub fn side_preview(self, value: bool) -> Self
pub fn side_preview(self, value: bool) -> Self
Enables/disables the bigger color preview on the right side of the picker.
Sourcepub fn alpha_bar(self, value: bool) -> Self
pub fn alpha_bar(self, value: bool) -> Self
Enables/disables the vertical alpha bar/gradient in the color picker.
Sourcepub fn preview(self, preview: ColorPreview) -> Self
pub fn preview(self, preview: ColorPreview) -> Self
Sets the preview style.
Sourcepub fn input_mode(self, input_mode: ColorEditInputMode) -> Self
pub fn input_mode(self, input_mode: ColorEditInputMode) -> Self
Sets the data format for input and output data.
Sourcepub fn display_rgb(self, value: bool) -> Self
pub fn display_rgb(self, value: bool) -> Self
Enables/disables displaying the value as RGB.
Sourcepub fn display_hsv(self, value: bool) -> Self
pub fn display_hsv(self, value: bool) -> Self
Enables/disables displaying the value as HSV.
Sourcepub fn display_hex(self, value: bool) -> Self
pub fn display_hex(self, value: bool) -> Self
Enables/disables displaying the value as hex.
Sourcepub fn mode(self, mode: ColorPickerMode) -> Self
pub fn mode(self, mode: ColorPickerMode) -> Self
Sets the hue/saturation/value editor mode.
Sourcepub fn format(self, format: ColorFormat) -> Self
pub fn format(self, format: ColorFormat) -> Self
Sets the formatting style of color components.
Sourcepub fn reference_color(self, ref_color: &'a [f32; 4]) -> Self
pub fn reference_color(self, ref_color: &'a [f32; 4]) -> Self
Sets the shown reference color.