ColorToHexConverter
struct · ferroui-controls-color-picker · v0.5.0
struct ColorToHexConverter
Converts a color to a hex string and vice versa.
Members
newis_alpha_visibleset_is_alpha_visiblealpha_positionset_alpha_positionto_hex_stringparse_hex_string
new
fn new() -> Self
Initializes a new instance of the ColorToHexConverter class.
is_alpha_visible
fn is_alpha_visible(self: &Self) -> bool
Gets a value indicating whether the alpha component is visible in the Hex formatted text.
When hidden the existing alpha component value is maintained. Also when hidden the user is still able to input an 8-digit number with alpha. Alpha will be processed but then removed when displayed.
Because this property only controls whether alpha is displayed (and it is still processed regardless) it is termed 'Visible' instead of 'Enabled'.
set_is_alpha_visible
fn set_is_alpha_visible(self: &Self, value: bool)
Sets is_alpha_visible.
alpha_position
fn alpha_position(self: &Self) -> AlphaComponentPosition
Gets the position of a color's alpha component relative to all other components.
set_alpha_position
fn set_alpha_position(self: &Self, value: AlphaComponentPosition)
Sets alpha_position.
to_hex_string
fn to_hex_string(color: Color, alpha_position: AlphaComponentPosition, include_alpha: bool, include_symbol: bool) -> String
Converts the given color to its hex color value string representation.
color: the color to represent as a hex value string.alpha_position: the output position of the alpha component.include_alpha: whether the alpha component will be included in the hex string (upstream's default istrue).include_symbol: whether the hex symbol '#' will be added (upstream's default isfalse).
parse_hex_string
fn parse_hex_string(hex_color: &str, alpha_position: AlphaComponentPosition) -> Option<Color>
Parses a hex color value string into a new Color.
hex_color is the hex color string to parse (with or without the
'#' symbol); alpha_position is the input position of the alpha
component. Returns the parsed color; otherwise, None.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyAnyValueClassDefaultsErasedDestructorIntoEitherDebugDefaultIValueConverterPartialEqMarkupTyped
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.