From 68cca6eb381f88e861439ed6a1dda1ab6a7429d3 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Mon, 12 Jun 2017 12:16:57 +0200 Subject: Support web notation for hex colors --- src/config.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/config.rs b/src/config.rs index d49caae8..4dffa70a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -965,8 +965,11 @@ impl FromStr for Rgb { } } - if chars.next().unwrap() != '0' { return Err(()); } - if chars.next().unwrap() != 'x' { return Err(()); } + match chars.next().unwrap() { + '0' => if chars.next().unwrap() != 'x' { return Err(()); }, + '#' => (), + _ => return Err(()), + } component!(r, g, b); -- cgit