Add support for 'with' in mixing

E.g., `mix white with black`.
master
Ben Moon 2016-07-05 21:23:39 +01:00
parent ee5e5e7e51
commit 06e0da0503
2 changed files with 5 additions and 3 deletions

View File

@ -109,11 +109,12 @@ sub remainder_probably_relevant {
my $mix_re = 'mix(ed)?';
my $reverse_re = "(opposite|complement(ary)?)( $scolor)?( (of|to|for))?";
my $dual_colors_re = "(?<c1>$color_re)( and)? (?<c2>$color_re)";
my $dual_colors_mix = qr/(?<c1>$color_re)( (and|with))? (?<c2>$color_re)/;
my $dual_colors_and = qr/(?<c1>$color_re)( and)? (?<c2>$color_re)/;
my %query_cat = (
random => "rand(om)? $scolor( between $dual_colors_re)?\$",
mix => "$mix_re $dual_colors_re|$dual_colors_re $mix_re",
random => "rand(om)? $scolor( between $dual_colors_and)?\$",
mix => "$mix_re $dual_colors_mix|$dual_colors_mix $mix_re",
reverse => "$reverse_re (?<c>$color_re)",
);
my %query_forms = (

View File

@ -202,6 +202,7 @@ ddg_goodie_test(
# Mixing colors
'mix 000000 ffffff' => $tc_mix_black_white,
'black and white mixed' => $tc_mix_black_white,
'mix black with white' => $tc_mix_black_white,
# # With leading '#'
'mix #000000 #ffffff' => $tc_mix_black_white,
# # 'and'