Allow use of 'and' when mixing colors

master
Ben Moon 2016-07-05 11:50:31 +01:00
parent 67460e170d
commit 5707700a7c
2 changed files with 3 additions and 1 deletions

View File

@ -36,7 +36,7 @@ sub normalize_color {
my %query_forms = (
"rand(om)? $scolor" => \&random_color,
"mix (?<c1>$color_re) (?<c2>$color_re)" => \&mix_colors,
"mix (?<c1>$color_re)( and)? (?<c2>$color_re)" => \&mix_colors,
);
my @query_forms = keys %query_forms;

View File

@ -84,6 +84,8 @@ ddg_goodie_test(
'mix 000000 ffffff' => $tc_mix_white_black,
# # With leading '#'
'mix #000000 #ffffff' => $tc_mix_white_black,
# # 'and'
'mix 000000 and ffffff' => $tc_mix_white_black,
# Invalid queries
'color' => undef,
'color ffffff' => undef,