fn encode_color(r: &str, g: &str, b: &str, a: Option<&str>) -> Color {
	let r_parsed: f32 = r.trim().parse().expect("Unable to cast to float");
	let g_parsed: f32 = g.trim().parse().expect("Unable to cast to float");
	let b_parsed: f32 = b.trim().parse().expect("Unable to cast to float");

	match a {
		Some(alpha) => {
			let a_parsed: f32 = alpha.trim().parse().expect("Unable to cast to float");
			return Color::rgba(r_parsed, g_parsed, b_parsed, a_parsed);
		}
		None => return Color::rgb(r_parsed, g_parsed, b_parsed),
	};
}
/// Returns a Color from the specified rgb and optional a.
///
/// # Arguments
///
/// `r` - The red value of the color.
/// `g` - The green value of the color.
/// `b` - The blue value of the color.
/// `a` - The optional alpha value of the color.
Returns a Color from the specified rgb and optional a.
Returns a Color from the specified rgb and optional a .
fn encode_color(r: &str, g: &str, b: &str, a: Option<&str>) -> Color {
	let r_parsed: f32 = r.trim().parse().expect("Unable to cast to float");
	let g_parsed: f32 = g.trim().parse().expect("Unable to cast to float");
	let b_parsed: f32 = b.trim().parse().expect("Unable to cast to float");
	match a {
		Some(alpha) => {
			let a_parsed: f32 = alpha.trim().parse().expect("Unable to cast to float");
			return Color::rgba(r_parsed, g_parsed, b_parsed, a_parsed);
		}
		None => return Color::rgb(r_parsed, g_parsed, b_parsed),
	};
}
fn encode_color ( r : & str , g : & str , b : & str , a : Option < & str > ) -> Color { let r_parsed : f32 = r . trim ( ) . parse ( ) . expect ( " " ) ; let g_parsed : f32 = g . trim ( ) . parse ( ) . expect ( " " ) ; let b_parsed : f32 = b . trim ( ) . parse ( ) . expect ( " " ) ; match a { Some ( alpha ) => { let a_parsed : f32 = alpha . trim ( ) . parse ( ) . expect ( " " ) ; return Color :: rgba ( r_parsed , g_parsed , b_parsed , a_parsed ) ; } None => return Color :: rgb ( r_parsed , g_parsed , b_parsed ) , } ; }
Returns a Color from the specified rgb and optional a.
Returns a Color from the specified rgb and optional a .
r
&str
g
&str
b
&str
a
Option<&str>