1pub use self::kinds::PrimaryColor;
7pub use self::kinds::SecondaryColor;
8pub use self::utils::mix;
9
10pub mod kinds {
11 pub enum PrimaryColor {
13 Red,
14 Yellow,
15 Blue,
16 }
17
18 pub enum SecondaryColor {
20 Orange,
21 Green,
22 Purple,
23 }
24}
25
26pub mod utils {
27 use crate::kinds::*;
28
29 pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor {
32 match (c1, c2) {
33 (PrimaryColor::Red, PrimaryColor::Yellow) => SecondaryColor::Orange,
34 (PrimaryColor::Yellow, PrimaryColor::Red) => SecondaryColor::Orange,
35 (PrimaryColor::Blue, PrimaryColor::Yellow) => SecondaryColor::Green,
36 (PrimaryColor::Yellow, PrimaryColor::Blue) => SecondaryColor::Green,
37 (PrimaryColor::Blue, PrimaryColor::Red) => SecondaryColor::Purple,
38 (PrimaryColor::Red, PrimaryColor::Blue) => SecondaryColor::Purple,
39 _ => {
40 panic!("Invalid color combination");
41 }
42 }
43 }
44}