use crate::cubehelix::{self, Cubehelix};
use crate::gradient::EvalGradient;
use crate::sequential::Sequential;
use crate::{interpolate, Color, Gradient};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/turbo.png" width="100%" height="40" alt="turbo">
pub const TURBO: Gradient = Gradient { eval: &Turbo };

struct Turbo;

impl EvalGradient for Turbo {
    fn name(&self) -> &'static str {
        "Turbo"
    }

    fn eval_continuous(&self, t: f32) -> Color {
        let r =
            34.61 + t * (1172.33 - t * (10793.56 - t * (33300.12 - t * (38394.49 - t * 14825.05))));
        let g = 23.31 + t * (557.33 + t * (1225.33 - t * (3574.96 - t * (1073.77 + t * 707.56))));
        let b = 27.2 + t * (3211.1 - t * (15327.97 - t * (27814.0 - t * (22569.18 - t * 6838.66))));
        Color {
            r: color_value(r),
            g: color_value(g),
            b: color_value(b),
        }
    }
}

fn color_value(value: f32) -> u8 {
    if value < 0.0 {
        return 0;
    }

    if value > 255.0 {
        return 255;
    }

    value as u8
}

struct Ramp {
    name: &'static str,
    colors: [Color; 256],
}

impl EvalGradient for Ramp {
    fn name(&self) -> &'static str {
        self.name
    }

    fn eval_continuous(&self, t: f32) -> Color {
        interpolate::spline(&self.colors, t)
    }
}

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/viridis.png" width="100%" height="40" alt="viridis">
pub const VIRIDIS: Gradient = Gradient {
    eval: &Ramp {
        name: "Viridis",
        colors: colors! {
            0x440154 0x440256 0x450457 0x450559 0x46075a 0x46085c 0x460a5d 0x460b5e
            0x470d60 0x470e61 0x471063 0x471164 0x471365 0x481467 0x481668 0x481769
            0x48186a 0x481a6c 0x481b6d 0x481c6e 0x481d6f 0x481f70 0x482071 0x482173
            0x482374 0x482475 0x482576 0x482677 0x482878 0x482979 0x472a7a 0x472c7a
            0x472d7b 0x472e7c 0x472f7d 0x46307e 0x46327e 0x46337f 0x463480 0x453581
            0x453781 0x453882 0x443983 0x443a83 0x443b84 0x433d84 0x433e85 0x423f85
            0x424086 0x424186 0x414287 0x414487 0x404588 0x404688 0x3f4788 0x3f4889
            0x3e4989 0x3e4a89 0x3e4c8a 0x3d4d8a 0x3d4e8a 0x3c4f8a 0x3c508b 0x3b518b
            0x3b528b 0x3a538b 0x3a548c 0x39558c 0x39568c 0x38588c 0x38598c 0x375a8c
            0x375b8d 0x365c8d 0x365d8d 0x355e8d 0x355f8d 0x34608d 0x34618d 0x33628d
            0x33638d 0x32648e 0x32658e 0x31668e 0x31678e 0x31688e 0x30698e 0x306a8e
            0x2f6b8e 0x2f6c8e 0x2e6d8e 0x2e6e8e 0x2e6f8e 0x2d708e 0x2d718e 0x2c718e
            0x2c728e 0x2c738e 0x2b748e 0x2b758e 0x2a768e 0x2a778e 0x2a788e 0x29798e
            0x297a8e 0x297b8e 0x287c8e 0x287d8e 0x277e8e 0x277f8e 0x27808e 0x26818e
            0x26828e 0x26828e 0x25838e 0x25848e 0x25858e 0x24868e 0x24878e 0x23888e
            0x23898e 0x238a8d 0x228b8d 0x228c8d 0x228d8d 0x218e8d 0x218f8d 0x21908d
            0x21918c 0x20928c 0x20928c 0x20938c 0x1f948c 0x1f958b 0x1f968b 0x1f978b
            0x1f988b 0x1f998a 0x1f9a8a 0x1e9b8a 0x1e9c89 0x1e9d89 0x1f9e89 0x1f9f88
            0x1fa088 0x1fa188 0x1fa187 0x1fa287 0x20a386 0x20a486 0x21a585 0x21a685
            0x22a785 0x22a884 0x23a983 0x24aa83 0x25ab82 0x25ac82 0x26ad81 0x27ad81
            0x28ae80 0x29af7f 0x2ab07f 0x2cb17e 0x2db27d 0x2eb37c 0x2fb47c 0x31b57b
            0x32b67a 0x34b679 0x35b779 0x37b878 0x38b977 0x3aba76 0x3bbb75 0x3dbc74
            0x3fbc73 0x40bd72 0x42be71 0x44bf70 0x46c06f 0x48c16e 0x4ac16d 0x4cc26c
            0x4ec36b 0x50c46a 0x52c569 0x54c568 0x56c667 0x58c765 0x5ac864 0x5cc863
            0x5ec962 0x60ca60 0x63cb5f 0x65cb5e 0x67cc5c 0x69cd5b 0x6ccd5a 0x6ece58
            0x70cf57 0x73d056 0x75d054 0x77d153 0x7ad151 0x7cd250 0x7fd34e 0x81d34d
            0x84d44b 0x86d549 0x89d548 0x8bd646 0x8ed645 0x90d743 0x93d741 0x95d840
            0x98d83e 0x9bd93c 0x9dd93b 0xa0da39 0xa2da37 0xa5db36 0xa8db34 0xaadc32
            0xaddc30 0xb0dd2f 0xb2dd2d 0xb5de2b 0xb8de29 0xbade28 0xbddf26 0xc0df25
            0xc2df23 0xc5e021 0xc8e020 0xcae11f 0xcde11d 0xd0e11c 0xd2e21b 0xd5e21a
            0xd8e219 0xdae319 0xdde318 0xdfe318 0xe2e418 0xe5e419 0xe7e419 0xeae51a
            0xece51b 0xefe51c 0xf1e51d 0xf4e61e 0xf6e620 0xf8e621 0xfbe723 0xfde725
        },
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/inferno.png" width="100%" height="40" alt="inferno">
pub const INFERNO: Gradient = Gradient {
    eval: &Ramp {
        name: "Inferno",
        colors: colors! {
            0x000004 0x010005 0x010106 0x010108 0x02010a 0x02020c 0x02020e 0x030210
            0x040312 0x040314 0x050417 0x060419 0x07051b 0x08051d 0x09061f 0x0a0722
            0x0b0724 0x0c0826 0x0d0829 0x0e092b 0x10092d 0x110a30 0x120a32 0x140b34
            0x150b37 0x160b39 0x180c3c 0x190c3e 0x1b0c41 0x1c0c43 0x1e0c45 0x1f0c48
            0x210c4a 0x230c4c 0x240c4f 0x260c51 0x280b53 0x290b55 0x2b0b57 0x2d0b59
            0x2f0a5b 0x310a5c 0x320a5e 0x340a5f 0x360961 0x380962 0x390963 0x3b0964
            0x3d0965 0x3e0966 0x400a67 0x420a68 0x440a68 0x450a69 0x470b6a 0x490b6a
            0x4a0c6b 0x4c0c6b 0x4d0d6c 0x4f0d6c 0x510e6c 0x520e6d 0x540f6d 0x550f6d
            0x57106e 0x59106e 0x5a116e 0x5c126e 0x5d126e 0x5f136e 0x61136e 0x62146e
            0x64156e 0x65156e 0x67166e 0x69166e 0x6a176e 0x6c186e 0x6d186e 0x6f196e
            0x71196e 0x721a6e 0x741a6e 0x751b6e 0x771c6d 0x781c6d 0x7a1d6d 0x7c1d6d
            0x7d1e6d 0x7f1e6c 0x801f6c 0x82206c 0x84206b 0x85216b 0x87216b 0x88226a
            0x8a226a 0x8c2369 0x8d2369 0x8f2469 0x902568 0x922568 0x932667 0x952667
            0x972766 0x982766 0x9a2865 0x9b2964 0x9d2964 0x9f2a63 0xa02a63 0xa22b62
            0xa32c61 0xa52c60 0xa62d60 0xa82e5f 0xa92e5e 0xab2f5e 0xad305d 0xae305c
            0xb0315b 0xb1325a 0xb3325a 0xb43359 0xb63458 0xb73557 0xb93556 0xba3655
            0xbc3754 0xbd3853 0xbf3952 0xc03a51 0xc13a50 0xc33b4f 0xc43c4e 0xc63d4d
            0xc73e4c 0xc83f4b 0xca404a 0xcb4149 0xcc4248 0xce4347 0xcf4446 0xd04545
            0xd24644 0xd34743 0xd44842 0xd54a41 0xd74b3f 0xd84c3e 0xd94d3d 0xda4e3c
            0xdb503b 0xdd513a 0xde5238 0xdf5337 0xe05536 0xe15635 0xe25734 0xe35933
            0xe45a31 0xe55c30 0xe65d2f 0xe75e2e 0xe8602d 0xe9612b 0xea632a 0xeb6429
            0xeb6628 0xec6726 0xed6925 0xee6a24 0xef6c23 0xef6e21 0xf06f20 0xf1711f
            0xf1731d 0xf2741c 0xf3761b 0xf37819 0xf47918 0xf57b17 0xf57d15 0xf67e14
            0xf68013 0xf78212 0xf78410 0xf8850f 0xf8870e 0xf8890c 0xf98b0b 0xf98c0a
            0xf98e09 0xfa9008 0xfa9207 0xfa9407 0xfb9606 0xfb9706 0xfb9906 0xfb9b06
            0xfb9d07 0xfc9f07 0xfca108 0xfca309 0xfca50a 0xfca60c 0xfca80d 0xfcaa0f
            0xfcac11 0xfcae12 0xfcb014 0xfcb216 0xfcb418 0xfbb61a 0xfbb81d 0xfbba1f
            0xfbbc21 0xfbbe23 0xfac026 0xfac228 0xfac42a 0xfac62d 0xf9c72f 0xf9c932
            0xf9cb35 0xf8cd37 0xf8cf3a 0xf7d13d 0xf7d340 0xf6d543 0xf6d746 0xf5d949
            0xf5db4c 0xf4dd4f 0xf4df53 0xf4e156 0xf3e35a 0xf3e55d 0xf2e661 0xf2e865
            0xf2ea69 0xf1ec6d 0xf1ed71 0xf1ef75 0xf1f179 0xf2f27d 0xf2f482 0xf3f586
            0xf3f68a 0xf4f88e 0xf5f992 0xf6fa96 0xf8fb9a 0xf9fc9d 0xfafda1 0xfcffa4
        },
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/magma.png" width="100%" height="40" alt="magma">
pub const MAGMA: Gradient = Gradient {
    eval: &Ramp {
        name: "Magma",
        colors: colors! {
            0x000004 0x010005 0x010106 0x010108 0x020109 0x02020b 0x02020d 0x03030f
            0x030312 0x040414 0x050416 0x060518 0x06051a 0x07061c 0x08071e 0x090720
            0x0a0822 0x0b0924 0x0c0926 0x0d0a29 0x0e0b2b 0x100b2d 0x110c2f 0x120d31
            0x130d34 0x140e36 0x150e38 0x160f3b 0x180f3d 0x19103f 0x1a1042 0x1c1044
            0x1d1147 0x1e1149 0x20114b 0x21114e 0x221150 0x241253 0x251255 0x271258
            0x29115a 0x2a115c 0x2c115f 0x2d1161 0x2f1163 0x311165 0x331067 0x341069
            0x36106b 0x38106c 0x390f6e 0x3b0f70 0x3d0f71 0x3f0f72 0x400f74 0x420f75
            0x440f76 0x451077 0x471078 0x491078 0x4a1079 0x4c117a 0x4e117b 0x4f127b
            0x51127c 0x52137c 0x54137d 0x56147d 0x57157e 0x59157e 0x5a167e 0x5c167f
            0x5d177f 0x5f187f 0x601880 0x621980 0x641a80 0x651a80 0x671b80 0x681c81
            0x6a1c81 0x6b1d81 0x6d1d81 0x6e1e81 0x701f81 0x721f81 0x732081 0x752181
            0x762181 0x782281 0x792282 0x7b2382 0x7c2382 0x7e2482 0x802582 0x812581
            0x832681 0x842681 0x862781 0x882781 0x892881 0x8b2981 0x8c2981 0x8e2a81
            0x902a81 0x912b81 0x932b80 0x942c80 0x962c80 0x982d80 0x992d80 0x9b2e7f
            0x9c2e7f 0x9e2f7f 0xa02f7f 0xa1307e 0xa3307e 0xa5317e 0xa6317d 0xa8327d
            0xaa337d 0xab337c 0xad347c 0xae347b 0xb0357b 0xb2357b 0xb3367a 0xb5367a
            0xb73779 0xb83779 0xba3878 0xbc3978 0xbd3977 0xbf3a77 0xc03a76 0xc23b75
            0xc43c75 0xc53c74 0xc73d73 0xc83e73 0xca3e72 0xcc3f71 0xcd4071 0xcf4070
            0xd0416f 0xd2426f 0xd3436e 0xd5446d 0xd6456c 0xd8456c 0xd9466b 0xdb476a
            0xdc4869 0xde4968 0xdf4a68 0xe04c67 0xe24d66 0xe34e65 0xe44f64 0xe55064
            0xe75263 0xe85362 0xe95462 0xea5661 0xeb5760 0xec5860 0xed5a5f 0xee5b5e
            0xef5d5e 0xf05f5e 0xf1605d 0xf2625d 0xf2645c 0xf3655c 0xf4675c 0xf4695c
            0xf56b5c 0xf66c5c 0xf66e5c 0xf7705c 0xf7725c 0xf8745c 0xf8765c 0xf9785d
            0xf9795d 0xf97b5d 0xfa7d5e 0xfa7f5e 0xfa815f 0xfb835f 0xfb8560 0xfb8761
            0xfc8961 0xfc8a62 0xfc8c63 0xfc8e64 0xfc9065 0xfd9266 0xfd9467 0xfd9668
            0xfd9869 0xfd9a6a 0xfd9b6b 0xfe9d6c 0xfe9f6d 0xfea16e 0xfea36f 0xfea571
            0xfea772 0xfea973 0xfeaa74 0xfeac76 0xfeae77 0xfeb078 0xfeb27a 0xfeb47b
            0xfeb67c 0xfeb77e 0xfeb97f 0xfebb81 0xfebd82 0xfebf84 0xfec185 0xfec287
            0xfec488 0xfec68a 0xfec88c 0xfeca8d 0xfecc8f 0xfecd90 0xfecf92 0xfed194
            0xfed395 0xfed597 0xfed799 0xfed89a 0xfdda9c 0xfddc9e 0xfddea0 0xfde0a1
            0xfde2a3 0xfde3a5 0xfde5a7 0xfde7a9 0xfde9aa 0xfdebac 0xfcecae 0xfceeb0
            0xfcf0b2 0xfcf2b4 0xfcf4b6 0xfcf6b8 0xfcf7b9 0xfcf9bb 0xfcfbbd 0xfcfdbf
        },
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/plasma.png" width="100%" height="40" alt="plasma">
pub const PLASMA: Gradient = Gradient {
    eval: &Ramp {
        name: "Plasma",
        colors: colors! {
            0x0d0887 0x100788 0x130789 0x16078a 0x19068c 0x1b068d 0x1d068e 0x20068f
            0x220690 0x240691 0x260591 0x280592 0x2a0593 0x2c0594 0x2e0595 0x2f0596
            0x310597 0x330597 0x350498 0x370499 0x38049a 0x3a049a 0x3c049b 0x3e049c
            0x3f049c 0x41049d 0x43039e 0x44039e 0x46039f 0x48039f 0x4903a0 0x4b03a1
            0x4c02a1 0x4e02a2 0x5002a2 0x5102a3 0x5302a3 0x5502a4 0x5601a4 0x5801a4
            0x5901a5 0x5b01a5 0x5c01a6 0x5e01a6 0x6001a6 0x6100a7 0x6300a7 0x6400a7
            0x6600a7 0x6700a8 0x6900a8 0x6a00a8 0x6c00a8 0x6e00a8 0x6f00a8 0x7100a8
            0x7201a8 0x7401a8 0x7501a8 0x7701a8 0x7801a8 0x7a02a8 0x7b02a8 0x7d03a8
            0x7e03a8 0x8004a8 0x8104a7 0x8305a7 0x8405a7 0x8606a6 0x8707a6 0x8808a6
            0x8a09a5 0x8b0aa5 0x8d0ba5 0x8e0ca4 0x8f0da4 0x910ea3 0x920fa3 0x9410a2
            0x9511a1 0x9613a1 0x9814a0 0x99159f 0x9a169f 0x9c179e 0x9d189d 0x9e199d
            0xa01a9c 0xa11b9b 0xa21d9a 0xa31e9a 0xa51f99 0xa62098 0xa72197 0xa82296
            0xaa2395 0xab2494 0xac2694 0xad2793 0xae2892 0xb02991 0xb12a90 0xb22b8f
            0xb32c8e 0xb42e8d 0xb52f8c 0xb6308b 0xb7318a 0xb83289 0xba3388 0xbb3488
            0xbc3587 0xbd3786 0xbe3885 0xbf3984 0xc03a83 0xc13b82 0xc23c81 0xc33d80
            0xc43e7f 0xc5407e 0xc6417d 0xc7427c 0xc8437b 0xc9447a 0xca457a 0xcb4679
            0xcc4778 0xcc4977 0xcd4a76 0xce4b75 0xcf4c74 0xd04d73 0xd14e72 0xd24f71
            0xd35171 0xd45270 0xd5536f 0xd5546e 0xd6556d 0xd7566c 0xd8576b 0xd9586a
            0xda5a6a 0xda5b69 0xdb5c68 0xdc5d67 0xdd5e66 0xde5f65 0xde6164 0xdf6263
            0xe06363 0xe16462 0xe26561 0xe26660 0xe3685f 0xe4695e 0xe56a5d 0xe56b5d
            0xe66c5c 0xe76e5b 0xe76f5a 0xe87059 0xe97158 0xe97257 0xea7457 0xeb7556
            0xeb7655 0xec7754 0xed7953 0xed7a52 0xee7b51 0xef7c51 0xef7e50 0xf07f4f
            0xf0804e 0xf1814d 0xf1834c 0xf2844b 0xf3854b 0xf3874a 0xf48849 0xf48948
            0xf58b47 0xf58c46 0xf68d45 0xf68f44 0xf79044 0xf79143 0xf79342 0xf89441
            0xf89540 0xf9973f 0xf9983e 0xf99a3e 0xfa9b3d 0xfa9c3c 0xfa9e3b 0xfb9f3a
            0xfba139 0xfba238 0xfca338 0xfca537 0xfca636 0xfca835 0xfca934 0xfdab33
            0xfdac33 0xfdae32 0xfdaf31 0xfdb130 0xfdb22f 0xfdb42f 0xfdb52e 0xfeb72d
            0xfeb82c 0xfeba2c 0xfebb2b 0xfebd2a 0xfebe2a 0xfec029 0xfdc229 0xfdc328
            0xfdc527 0xfdc627 0xfdc827 0xfdca26 0xfdcb26 0xfccd25 0xfcce25 0xfcd025
            0xfcd225 0xfbd324 0xfbd524 0xfbd724 0xfad824 0xfada24 0xf9dc24 0xf9dd25
            0xf8df25 0xf8e125 0xf7e225 0xf7e425 0xf6e626 0xf6e826 0xf5e926 0xf5eb27
            0xf4ed27 0xf3ee27 0xf3f027 0xf2f227 0xf1f426 0xf1f525 0xf0f724 0xf0f921
        },
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/cividis.png" width="100%" height="40" alt="cividis">
pub const CIVIDIS: Gradient = Gradient { eval: &Cividis };

struct Cividis;

impl EvalGradient for Cividis {
    fn name(&self) -> &'static str {
        "Cividis"
    }

    fn eval_continuous(&self, t: f32) -> Color {
        let r = (-4.54 - t * (35.34 - t * (2381.73 - t * (6402.7 - t * (7024.72 - t * 2710.57)))))
            .max(0.0)
            .min(255.0) as u8;
        let g = (32.49 + t * (170.73 + t * (52.82 - t * (131.46 - t * (176.58 - t * 67.37)))))
            .max(0.0)
            .min(255.0) as u8;
        let b = (81.24 + t * (442.36 - t * (2482.43 - t * (6167.24 - t * (6614.94 - t * 2475.67)))))
            .max(0.0)
            .min(255.0) as u8;
        Color { r, g, b }
    }
}

struct InterpolateCubehelix {
    name: &'static str,
    start: Cubehelix,
    end: Cubehelix,
}

impl EvalGradient for InterpolateCubehelix {
    fn name(&self) -> &'static str {
        self.name
    }

    fn eval_continuous(&self, t: f32) -> Color {
        cubehelix::interpolate(self.start, self.end, t).into()
    }
}

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/warm.png" width="100%" height="40" alt="warm">
pub const WARM: Gradient = Gradient {
    eval: &InterpolateCubehelix {
        name: "Warm",
        start: Cubehelix {
            h: -100.0,
            s: 0.75,
            l: 0.35,
        },
        end: Cubehelix {
            h: 80.0,
            s: 1.5,
            l: 0.8,
        },
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/cool.png" width="100%" height="40" alt="cool">
pub const COOL: Gradient = Gradient {
    eval: &InterpolateCubehelix {
        name: "Cool",
        start: Cubehelix {
            h: 260.0,
            s: 0.75,
            l: 0.35,
        },
        end: Cubehelix {
            h: 80.0,
            s: 1.5,
            l: 0.8,
        },
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/cubehelix.png" width="100%" height="40" alt="cubehelix">
pub const CUBEHELIX: Gradient = Gradient {
    eval: &InterpolateCubehelix {
        name: "Cubehelix",
        start: Cubehelix {
            h: 300.0,
            s: 0.5,
            l: 0.0,
        },
        end: Cubehelix {
            h: -240.0,
            s: 0.5,
            l: 1.0,
        },
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/BuGn.png" width="100%" height="40" alt="BuGn">
pub const BLUE_GREEN: Gradient = Gradient {
    eval: &Sequential {
        name: "BuGn",
        three: colors!(0xe5f5f9 0x99d8c9 0x2ca25f),
        four: colors!(0xedf8fb 0xb2e2e2 0x66c2a4 0x238b45),
        five: colors!(0xedf8fb 0xb2e2e2 0x66c2a4 0x2ca25f 0x006d2c),
        six: colors!(0xedf8fb 0xccece6 0x99d8c9 0x66c2a4 0x2ca25f 0x006d2c),
        seven: colors!(0xedf8fb 0xccece6 0x99d8c9 0x66c2a4 0x41ae76 0x238b45 0x005824),
        eight: colors!(0xf7fcfd 0xe5f5f9 0xccece6 0x99d8c9 0x66c2a4 0x41ae76 0x238b45 0x005824),
        nine: colors!(0xf7fcfd 0xe5f5f9 0xccece6 0x99d8c9 0x66c2a4 0x41ae76 0x238b45 0x006d2c 0x00441b),
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/BuPu.png" width="100%" height="40" alt="BuPu">
pub const BLUE_PURPLE: Gradient = Gradient {
    eval: &Sequential {
        name: "BuPu",
        three: colors!(0xe0ecf4 0x9ebcda 0x8856a7),
        four: colors!(0xedf8fb 0xb3cde3 0x8c96c6 0x88419d),
        five: colors!(0xedf8fb 0xb3cde3 0x8c96c6 0x8856a7 0x810f7c),
        six: colors!(0xedf8fb 0xbfd3e6 0x9ebcda 0x8c96c6 0x8856a7 0x810f7c),
        seven: colors!(0xedf8fb 0xbfd3e6 0x9ebcda 0x8c96c6 0x8c6bb1 0x88419d 0x6e016b),
        eight: colors!(0xf7fcfd 0xe0ecf4 0xbfd3e6 0x9ebcda 0x8c96c6 0x8c6bb1 0x88419d 0x6e016b),
        nine: colors!(0xf7fcfd 0xe0ecf4 0xbfd3e6 0x9ebcda 0x8c96c6 0x8c6bb1 0x88419d 0x810f7c 0x4d004b),
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/GnBu.png" width="100%" height="40" alt="GnBu">
pub const GREEN_BLUE: Gradient = Gradient {
    eval: &Sequential {
        name: "GnBu",
        three: colors!(0xe0f3db 0xa8ddb5 0x43a2ca),
        four: colors!(0xf0f9e8 0xbae4bc 0x7bccc4 0x2b8cbe),
        five: colors!(0xf0f9e8 0xbae4bc 0x7bccc4 0x43a2ca 0x0868ac),
        six: colors!(0xf0f9e8 0xccebc5 0xa8ddb5 0x7bccc4 0x43a2ca 0x0868ac),
        seven: colors!(0xf0f9e8 0xccebc5 0xa8ddb5 0x7bccc4 0x4eb3d3 0x2b8cbe 0x08589e),
        eight: colors!(0xf7fcf0 0xe0f3db 0xccebc5 0xa8ddb5 0x7bccc4 0x4eb3d3 0x2b8cbe 0x08589e),
        nine: colors!(0xf7fcf0 0xe0f3db 0xccebc5 0xa8ddb5 0x7bccc4 0x4eb3d3 0x2b8cbe 0x0868ac 0x084081),
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/OrRd.png" width="100%" height="40" alt="OrRd">
pub const ORANGE_RED: Gradient = Gradient {
    eval: &Sequential {
        name: "OrRd",
        three: colors!(0xfee8c8 0xfdbb84 0xe34a33),
        four: colors!(0xfef0d9 0xfdcc8a 0xfc8d59 0xd7301f),
        five: colors!(0xfef0d9 0xfdcc8a 0xfc8d59 0xe34a33 0xb30000),
        six: colors!(0xfef0d9 0xfdd49e 0xfdbb84 0xfc8d59 0xe34a33 0xb30000),
        seven: colors!(0xfef0d9 0xfdd49e 0xfdbb84 0xfc8d59 0xef6548 0xd7301f 0x990000),
        eight: colors!(0xfff7ec 0xfee8c8 0xfdd49e 0xfdbb84 0xfc8d59 0xef6548 0xd7301f 0x990000),
        nine: colors!(0xfff7ec 0xfee8c8 0xfdd49e 0xfdbb84 0xfc8d59 0xef6548 0xd7301f 0xb30000 0x7f0000),
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/PuBuGn.png" width="100%" height="40" alt="PuBuGn">
pub const PURPLE_BLUE_GREEN: Gradient = Gradient {
    eval: &Sequential {
        name: "PuBuGn",
        three: colors!(0xece2f0 0xa6bddb 0x1c9099),
        four: colors!(0xf6eff7 0xbdc9e1 0x67a9cf 0x02818a),
        five: colors!(0xf6eff7 0xbdc9e1 0x67a9cf 0x1c9099 0x016c59),
        six: colors!(0xf6eff7 0xd0d1e6 0xa6bddb 0x67a9cf 0x1c9099 0x016c59),
        seven: colors!(0xf6eff7 0xd0d1e6 0xa6bddb 0x67a9cf 0x3690c0 0x02818a 0x016450),
        eight: colors!(0xfff7fb 0xece2f0 0xd0d1e6 0xa6bddb 0x67a9cf 0x3690c0 0x02818a 0x016450),
        nine: colors!(0xfff7fb 0xece2f0 0xd0d1e6 0xa6bddb 0x67a9cf 0x3690c0 0x02818a 0x016c59 0x014636),
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/PuBu.png" width="100%" height="40" alt="PuBu">
pub const PURPLE_BLUE: Gradient = Gradient {
    eval: &Sequential {
        name: "PuBu",
        three: colors!(0xece7f2 0xa6bddb 0x2b8cbe),
        four: colors!(0xf1eef6 0xbdc9e1 0x74a9cf 0x0570b0),
        five: colors!(0xf1eef6 0xbdc9e1 0x74a9cf 0x2b8cbe 0x045a8d),
        six: colors!(0xf1eef6 0xd0d1e6 0xa6bddb 0x74a9cf 0x2b8cbe 0x045a8d),
        seven: colors!(0xf1eef6 0xd0d1e6 0xa6bddb 0x74a9cf 0x3690c0 0x0570b0 0x034e7b),
        eight: colors!(0xfff7fb 0xece7f2 0xd0d1e6 0xa6bddb 0x74a9cf 0x3690c0 0x0570b0 0x034e7b),
        nine: colors!(0xfff7fb 0xece7f2 0xd0d1e6 0xa6bddb 0x74a9cf 0x3690c0 0x0570b0 0x045a8d 0x023858),
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/PuRd.png" width="100%" height="40" alt="PuRd">
pub const PURPLE_RED: Gradient = Gradient {
    eval: &Sequential {
        name: "PuRd",
        three: colors!(0xe7e1ef 0xc994c7 0xdd1c77),
        four: colors!(0xf1eef6 0xd7b5d8 0xdf65b0 0xce1256),
        five: colors!(0xf1eef6 0xd7b5d8 0xdf65b0 0xdd1c77 0x980043),
        six: colors!(0xf1eef6 0xd4b9da 0xc994c7 0xdf65b0 0xdd1c77 0x980043),
        seven: colors!(0xf1eef6 0xd4b9da 0xc994c7 0xdf65b0 0xe7298a 0xce1256 0x91003f),
        eight: colors!(0xf7f4f9 0xe7e1ef 0xd4b9da 0xc994c7 0xdf65b0 0xe7298a 0xce1256 0x91003f),
        nine: colors!(0xf7f4f9 0xe7e1ef 0xd4b9da 0xc994c7 0xdf65b0 0xe7298a 0xce1256 0x980043 0x67001f),
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/RdPu.png" width="100%" height="40" alt="RdPu">
pub const RED_PURPLE: Gradient = Gradient {
    eval: &Sequential {
        name: "RdPu",
        three: colors!(0xfde0dd 0xfa9fb5 0xc51b8a),
        four: colors!(0xfeebe2 0xfbb4b9 0xf768a1 0xae017e),
        five: colors!(0xfeebe2 0xfbb4b9 0xf768a1 0xc51b8a 0x7a0177),
        six: colors!(0xfeebe2 0xfcc5c0 0xfa9fb5 0xf768a1 0xc51b8a 0x7a0177),
        seven: colors!(0xfeebe2 0xfcc5c0 0xfa9fb5 0xf768a1 0xdd3497 0xae017e 0x7a0177),
        eight: colors!(0xfff7f3 0xfde0dd 0xfcc5c0 0xfa9fb5 0xf768a1 0xdd3497 0xae017e 0x7a0177),
        nine: colors!(0xfff7f3 0xfde0dd 0xfcc5c0 0xfa9fb5 0xf768a1 0xdd3497 0xae017e 0x7a0177 0x49006a),
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/YlGnBu.png" width="100%" height="40" alt="YlGnBu">
pub const YELLOW_GREEN_BLUE: Gradient = Gradient {
    eval: &Sequential {
        name: "YlGnBu",
        three: colors!(0xedf8b1 0x7fcdbb 0x2c7fb8),
        four: colors!(0xffffcc 0xa1dab4 0x41b6c4 0x225ea8),
        five: colors!(0xffffcc 0xa1dab4 0x41b6c4 0x2c7fb8 0x253494),
        six: colors!(0xffffcc 0xc7e9b4 0x7fcdbb 0x41b6c4 0x2c7fb8 0x253494),
        seven: colors!(0xffffcc 0xc7e9b4 0x7fcdbb 0x41b6c4 0x1d91c0 0x225ea8 0x0c2c84),
        eight: colors!(0xffffd9 0xedf8b1 0xc7e9b4 0x7fcdbb 0x41b6c4 0x1d91c0 0x225ea8 0x0c2c84),
        nine: colors!(0xffffd9 0xedf8b1 0xc7e9b4 0x7fcdbb 0x41b6c4 0x1d91c0 0x225ea8 0x253494 0x081d58),
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/YlGn.png" width="100%" height="40" alt="YlGn">
pub const YELLOW_GREEN: Gradient = Gradient {
    eval: &Sequential {
        name: "YlGn",
        three: colors!(0xf7fcb9 0xaddd8e 0x31a354),
        four: colors!(0xffffcc 0xc2e699 0x78c679 0x238443),
        five: colors!(0xffffcc 0xc2e699 0x78c679 0x31a354 0x006837),
        six: colors!(0xffffcc 0xd9f0a3 0xaddd8e 0x78c679 0x31a354 0x006837),
        seven: colors!(0xffffcc 0xd9f0a3 0xaddd8e 0x78c679 0x41ab5d 0x238443 0x005a32),
        eight: colors!(0xffffe5 0xf7fcb9 0xd9f0a3 0xaddd8e 0x78c679 0x41ab5d 0x238443 0x005a32),
        nine: colors!(0xffffe5 0xf7fcb9 0xd9f0a3 0xaddd8e 0x78c679 0x41ab5d 0x238443 0x006837 0x004529),
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/YlOrBr.png" width="100%" height="40" alt="YlOrBr">
pub const YELLOW_ORANGE_BROWN: Gradient = Gradient {
    eval: &Sequential {
        name: "YlOrBr",
        three: colors!(0xfff7bc 0xfec44f 0xd95f0e),
        four: colors!(0xffffd4 0xfed98e 0xfe9929 0xcc4c02),
        five: colors!(0xffffd4 0xfed98e 0xfe9929 0xd95f0e 0x993404),
        six: colors!(0xffffd4 0xfee391 0xfec44f 0xfe9929 0xd95f0e 0x993404),
        seven: colors!(0xffffd4 0xfee391 0xfec44f 0xfe9929 0xec7014 0xcc4c02 0x8c2d04),
        eight: colors!(0xffffe5 0xfff7bc 0xfee391 0xfec44f 0xfe9929 0xec7014 0xcc4c02 0x8c2d04),
        nine: colors!(0xffffe5 0xfff7bc 0xfee391 0xfec44f 0xfe9929 0xec7014 0xcc4c02 0x993404 0x662506),
    },
};

/// &#8203;
///
/// <img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/YlOrRd.png" width="100%" height="40" alt="YlOrRd">
pub const YELLOW_ORANGE_RED: Gradient = Gradient {
    eval: &Sequential {
        name: "YlOrRd",
        three: colors!(0xffeda0 0xfeb24c 0xf03b20),
        four: colors!(0xffffb2 0xfecc5c 0xfd8d3c 0xe31a1c),
        five: colors!(0xffffb2 0xfecc5c 0xfd8d3c 0xf03b20 0xbd0026),
        six: colors!(0xffffb2 0xfed976 0xfeb24c 0xfd8d3c 0xf03b20 0xbd0026),
        seven: colors!(0xffffb2 0xfed976 0xfeb24c 0xfd8d3c 0xfc4e2a 0xe31a1c 0xb10026),
        eight: colors!(0xffffcc 0xffeda0 0xfed976 0xfeb24c 0xfd8d3c 0xfc4e2a 0xe31a1c 0xb10026),
        nine: colors!(0xffffcc 0xffeda0 0xfed976 0xfeb24c 0xfd8d3c 0xfc4e2a 0xe31a1c 0xbd0026 0x800026),
    },
};
