pub fn hex_str(string: &str) -> Option<Color> {
        let value = {
            if string.len() == 6 {
                u32::from_str_radix(string, 16)
            } else if string.len() == 7 {
                u32::from_str_radix(&string[1..], 16)
            } else {
                return None
            }
        };

        match value {
            Ok(value) => Some(Color::hex_int(value)),
            Err(_) =>    None,
        }
    }
/// Creates a color from a hex string. The string should be of the format "#rrggbb" or
/// "rrggbb", where each of r, g and b is a hexadecimal digit. Note that this currently does
/// not support loading colors with a alpha channel. All colors created will be completly
/// opaque.
Creates a color from a hex string. The string should be of the format "#rrggbb" or
"rrggbb", where each of r, g and b is a hexadecimal digit. Note that this currently does
not support loading colors with a alpha channel. All colors created will be completly
opaque.
Creates a color from a hex string . The string should be of the format " #rrggbb " or " rrggbb " where each of r g and b is a hexadecimal digit . Note that this currently does not support loading colors with a alpha channel . All colors created will be completly opaque .
pub fn hex_str(string: &str) -> Option<Color> {
        let value = {
            if string.len() == 6 {
                u32::from_str_radix(string, 16)
            } else if string.len() == 7 {
                u32::from_str_radix(&string[1..], 16)
            } else {
                return None
            }
        };
        match value {
            Ok(value) => Some(Color::hex_int(value)),
            Err(_) =>    None,
        }
    }
pub fn hex_str ( string : & str ) -> Option < Color > { let value = { if string . len ( ) == 6 { u32 :: from_str_radix ( string , 16 ) } else if string . len ( ) == 7 { u32 :: from_str_radix ( & string [ 1 .. ] , 16 ) } else { return None } } ; match value { Ok ( value ) => Some ( Color :: hex_int ( value ) ) , Err ( _ ) => None , } }
Creates a color from a hex string.
Creates a color from a hex string .
string
&str
string
&str