FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    ColorToHexConverter

    struct · ferroui-controls-color-picker · v0.5.0

    struct ColorToHexConverter
    

    Converts a color to a hex string and vice versa.

    View source

    Members

    new

    fn new() -> Self
    

    Initializes a new instance of the ColorToHexConverter class.

    Source

    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'.

    Source

    set_is_alpha_visible

    fn set_is_alpha_visible(self: &Self, value: bool)
    

    Sets is_alpha_visible.

    Source

    alpha_position

    fn alpha_position(self: &Self) -> AlphaComponentPosition
    

    Gets the position of a color's alpha component relative to all other components.

    Source

    set_alpha_position

    fn set_alpha_position(self: &Self, value: AlphaComponentPosition)
    

    Sets alpha_position.

    Source

    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 is true).
    • include_symbol: whether the hex symbol '#' will be added (upstream's default is false).

    Source

    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.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.