Fixed color rendering for good
This commit was merged in pull request #26.
This commit is contained in:
+145
-145
@@ -4,7 +4,7 @@ use alloc::{string::String, vec::Vec};
|
||||
use num_enum::FromPrimitive;
|
||||
|
||||
use crate::card::decoder::{Events, decode_known_event, decode_packed_card_text, decode_secret};
|
||||
use embedded_graphics::pixelcolor::Rgb565;
|
||||
use embedded_graphics::pixelcolor::{Rgb565, Rgb888};
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct NfcPayload<'a> {
|
||||
@@ -22,14 +22,14 @@ pub struct NfcPayload<'a> {
|
||||
#[repr(u8)]
|
||||
pub enum CardType {
|
||||
#[num_enum(default)]
|
||||
Default = 0,
|
||||
Blueprint = 1,
|
||||
CYBER = 2,
|
||||
Nature = 3,
|
||||
Fossil = 4,
|
||||
Ghost = 5,
|
||||
Daemon = 6,
|
||||
Fairy = 7,
|
||||
Default = 1,
|
||||
Blueprint = 2,
|
||||
CYBER = 3,
|
||||
Nature = 4,
|
||||
Fossil = 5,
|
||||
Ghost = 6,
|
||||
Daemon = 7,
|
||||
Fairy = 8,
|
||||
}
|
||||
|
||||
impl Display for CardType {
|
||||
@@ -51,14 +51,14 @@ pub type PrimaryColor = Rgb565;
|
||||
impl Into<PrimaryColor> for CardType {
|
||||
fn into(self) -> PrimaryColor {
|
||||
match self {
|
||||
CardType::Default => Rgb565::new(0xD8, 0x68, 0x30),
|
||||
CardType::Blueprint => Rgb565::new(0x6D, 0x81, 0xFF),
|
||||
CardType::CYBER => Rgb565::new(0xFF, 0xFF, 0x04),
|
||||
CardType::Nature => Rgb565::new(0x55, 0xA0, 0x58),
|
||||
CardType::Fossil => Rgb565::new(0xB9, 0x7A, 0x60),
|
||||
CardType::Ghost => Rgb565::new(0xAB, 0xAB, 0xAB),
|
||||
CardType::Daemon => Rgb565::new(0x60, 0x00, 0x88),
|
||||
CardType::Fairy => Rgb565::new(0xB0, 0xA9, 0xE4),
|
||||
CardType::Default => Rgb888::new(0xD8, 0x68, 0x30).into(),
|
||||
CardType::Blueprint => Rgb888::new(0x6D, 0x81, 0xFF).into(),
|
||||
CardType::CYBER => Rgb888::new(0xFF, 0xFF, 0x04).into(),
|
||||
CardType::Nature => Rgb888::new(0x55, 0xA0, 0x58).into(),
|
||||
CardType::Fossil => Rgb888::new(0xB9, 0x7A, 0x60).into(),
|
||||
CardType::Ghost => Rgb888::new(0xAB, 0xAB, 0xAB).into(),
|
||||
CardType::Daemon => Rgb888::new(0x60, 0x00, 0x88).into(),
|
||||
CardType::Fairy => Rgb888::new(0xB0, 0xA9, 0xE4).into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,148 +68,148 @@ impl Into<Palette> for CardType {
|
||||
fn into(self) -> Palette {
|
||||
match self {
|
||||
CardType::Default => [
|
||||
Rgb565::new(31, 23, 35),
|
||||
Rgb565::new(60, 47, 82),
|
||||
Rgb565::new(178, 39, 65),
|
||||
Rgb565::new(70, 86, 165),
|
||||
Rgb565::new(245, 70, 76),
|
||||
Rgb565::new(216, 104, 48),
|
||||
Rgb565::new(140, 127, 144),
|
||||
Rgb565::new(73, 149, 243),
|
||||
Rgb565::new(62, 197, 75),
|
||||
Rgb565::new(240, 149, 72),
|
||||
Rgb565::new(188, 176, 179),
|
||||
Rgb565::new(247, 156, 136),
|
||||
Rgb565::new(114, 222, 235),
|
||||
Rgb565::new(180, 230, 86),
|
||||
Rgb565::new(239, 208, 129),
|
||||
Rgb565::new(255, 255, 255),
|
||||
Rgb888::new(31, 23, 35).into(),
|
||||
Rgb888::new(60, 47, 82).into(),
|
||||
Rgb888::new(178, 39, 65).into(),
|
||||
Rgb888::new(70, 86, 165).into(),
|
||||
Rgb888::new(245, 70, 76).into(),
|
||||
Rgb888::new(216, 104, 48).into(),
|
||||
Rgb888::new(140, 127, 144).into(),
|
||||
Rgb888::new(73, 149, 243).into(),
|
||||
Rgb888::new(62, 197, 75).into(),
|
||||
Rgb888::new(240, 149, 72).into(),
|
||||
Rgb888::new(188, 176, 179).into(),
|
||||
Rgb888::new(247, 156, 136).into(),
|
||||
Rgb888::new(114, 222, 235).into(),
|
||||
Rgb888::new(180, 230, 86).into(),
|
||||
Rgb888::new(239, 208, 129).into(),
|
||||
Rgb888::new(255, 255, 255).into(),
|
||||
],
|
||||
CardType::Blueprint => [
|
||||
Rgb565::new(83, 67, 127),
|
||||
Rgb565::new(44, 111, 153),
|
||||
Rgb565::new(142, 88, 111),
|
||||
Rgb565::new(0, 188, 170),
|
||||
Rgb565::new(153, 104, 226),
|
||||
Rgb565::new(109, 129, 255),
|
||||
Rgb565::new(255, 84, 112),
|
||||
Rgb565::new(196, 143, 158),
|
||||
Rgb565::new(168, 159, 204),
|
||||
Rgb565::new(190, 155, 255),
|
||||
Rgb565::new(255, 155, 113),
|
||||
Rgb565::new(127, 206, 255),
|
||||
Rgb565::new(255, 155, 182),
|
||||
Rgb565::new(255, 217, 174),
|
||||
Rgb565::new(255, 217, 232),
|
||||
Rgb565::new(255, 255, 255),
|
||||
Rgb888::new(83, 67, 127).into(),
|
||||
Rgb888::new(44, 111, 153).into(),
|
||||
Rgb888::new(142, 88, 111).into(),
|
||||
Rgb888::new(0, 188, 170).into(),
|
||||
Rgb888::new(153, 104, 226).into(),
|
||||
Rgb888::new(109, 129, 255).into(),
|
||||
Rgb888::new(255, 84, 112).into(),
|
||||
Rgb888::new(196, 143, 158).into(),
|
||||
Rgb888::new(168, 159, 204).into(),
|
||||
Rgb888::new(190, 155, 255).into(),
|
||||
Rgb888::new(255, 155, 113).into(),
|
||||
Rgb888::new(127, 206, 255).into(),
|
||||
Rgb888::new(255, 155, 182).into(),
|
||||
Rgb888::new(255, 217, 174).into(),
|
||||
Rgb888::new(255, 217, 232).into(),
|
||||
Rgb888::new(255, 255, 255).into(),
|
||||
],
|
||||
CardType::CYBER => [
|
||||
Rgb565::new(0, 0, 0),
|
||||
Rgb565::new(0, 0, 126),
|
||||
Rgb565::new(0, 0, 255),
|
||||
Rgb565::new(126, 0, 0),
|
||||
Rgb565::new(126, 0, 126),
|
||||
Rgb565::new(4, 126, 0),
|
||||
Rgb565::new(254, 0, 0),
|
||||
Rgb565::new(4, 126, 126),
|
||||
Rgb565::new(254, 0, 255),
|
||||
Rgb565::new(126, 126, 0),
|
||||
Rgb565::new(126, 126, 126),
|
||||
Rgb565::new(6, 255, 4),
|
||||
Rgb565::new(6, 255, 255),
|
||||
Rgb565::new(190, 190, 190),
|
||||
Rgb565::new(255, 255, 4),
|
||||
Rgb565::new(255, 255, 255),
|
||||
Rgb888::new(0, 0, 0).into(),
|
||||
Rgb888::new(0, 0, 126).into(),
|
||||
Rgb888::new(0, 0, 255).into(),
|
||||
Rgb888::new(126, 0, 0).into(),
|
||||
Rgb888::new(126, 0, 126).into(),
|
||||
Rgb888::new(4, 126, 0).into(),
|
||||
Rgb888::new(254, 0, 0).into(),
|
||||
Rgb888::new(4, 126, 126).into(),
|
||||
Rgb888::new(254, 0, 255).into(),
|
||||
Rgb888::new(126, 126, 0).into(),
|
||||
Rgb888::new(126, 126, 126).into(),
|
||||
Rgb888::new(6, 255, 4).into(),
|
||||
Rgb888::new(6, 255, 255).into(),
|
||||
Rgb888::new(190, 190, 190).into(),
|
||||
Rgb888::new(255, 255, 4).into(),
|
||||
Rgb888::new(255, 255, 255).into(),
|
||||
],
|
||||
CardType::Nature => [
|
||||
Rgb565::new(35, 34, 40),
|
||||
Rgb565::new(40, 66, 97),
|
||||
Rgb565::new(30, 116, 83),
|
||||
Rgb565::new(117, 77, 69),
|
||||
Rgb565::new(95, 88, 84),
|
||||
Rgb565::new(36, 133, 166),
|
||||
Rgb565::new(198, 80, 70),
|
||||
Rgb565::new(85, 160, 88),
|
||||
Rgb565::new(135, 133, 115),
|
||||
Rgb565::new(84, 186, 210),
|
||||
Rgb565::new(161, 191, 65),
|
||||
Rgb565::new(230, 146, 138),
|
||||
Rgb565::new(184, 176, 149),
|
||||
Rgb565::new(227, 192, 84),
|
||||
Rgb565::new(195, 213, 199),
|
||||
Rgb565::new(255, 255, 255),
|
||||
Rgb888::new(35, 34, 40).into(),
|
||||
Rgb888::new(40, 66, 97).into(),
|
||||
Rgb888::new(30, 116, 83).into(),
|
||||
Rgb888::new(117, 77, 69).into(),
|
||||
Rgb888::new(95, 88, 84).into(),
|
||||
Rgb888::new(36, 133, 166).into(),
|
||||
Rgb888::new(198, 80, 70).into(),
|
||||
Rgb888::new(85, 160, 88).into(),
|
||||
Rgb888::new(135, 133, 115).into(),
|
||||
Rgb888::new(84, 186, 210).into(),
|
||||
Rgb888::new(161, 191, 65).into(),
|
||||
Rgb888::new(230, 146, 138).into(),
|
||||
Rgb888::new(184, 176, 149).into(),
|
||||
Rgb888::new(227, 192, 84).into(),
|
||||
Rgb888::new(195, 213, 199).into(),
|
||||
Rgb888::new(255, 255, 255).into(),
|
||||
],
|
||||
CardType::Fossil => [
|
||||
Rgb565::new(75, 61, 68),
|
||||
Rgb565::new(119, 66, 81),
|
||||
Rgb565::new(78, 84, 99),
|
||||
Rgb565::new(100, 83, 85),
|
||||
Rgb565::new(156, 82, 78),
|
||||
Rgb565::new(132, 109, 89),
|
||||
Rgb565::new(91, 125, 115),
|
||||
Rgb565::new(125, 123, 98),
|
||||
Rgb565::new(140, 124, 121),
|
||||
Rgb565::new(185, 122, 96),
|
||||
Rgb565::new(168, 138, 94),
|
||||
Rgb565::new(142, 159, 125),
|
||||
Rgb565::new(170, 162, 93),
|
||||
Rgb565::new(169, 156, 141),
|
||||
Rgb565::new(204, 168, 123),
|
||||
Rgb565::new(255, 255, 255),
|
||||
Rgb888::new(75, 61, 68).into(),
|
||||
Rgb888::new(119, 66, 81).into(),
|
||||
Rgb888::new(78, 84, 99).into(),
|
||||
Rgb888::new(100, 83, 85).into(),
|
||||
Rgb888::new(156, 82, 78).into(),
|
||||
Rgb888::new(132, 109, 89).into(),
|
||||
Rgb888::new(91, 125, 115).into(),
|
||||
Rgb888::new(125, 123, 98).into(),
|
||||
Rgb888::new(140, 124, 121).into(),
|
||||
Rgb888::new(185, 122, 96).into(),
|
||||
Rgb888::new(168, 138, 94).into(),
|
||||
Rgb888::new(142, 159, 125).into(),
|
||||
Rgb888::new(170, 162, 93).into(),
|
||||
Rgb888::new(169, 156, 141).into(),
|
||||
Rgb888::new(204, 168, 123).into(),
|
||||
Rgb888::new(255, 255, 255).into(),
|
||||
],
|
||||
CardType::Ghost => [
|
||||
Rgb565::new(0, 0, 0),
|
||||
Rgb565::new(24, 24, 24),
|
||||
Rgb565::new(40, 40, 40),
|
||||
Rgb565::new(56, 56, 56),
|
||||
Rgb565::new(71, 71, 71),
|
||||
Rgb565::new(86, 86, 86),
|
||||
Rgb565::new(100, 100, 100),
|
||||
Rgb565::new(113, 113, 113),
|
||||
Rgb565::new(126, 126, 126),
|
||||
Rgb565::new(140, 140, 140),
|
||||
Rgb565::new(155, 155, 155),
|
||||
Rgb565::new(171, 171, 171),
|
||||
Rgb565::new(189, 189, 189),
|
||||
Rgb565::new(209, 209, 209),
|
||||
Rgb565::new(231, 231, 231),
|
||||
Rgb565::new(255, 255, 255),
|
||||
Rgb888::new(0, 0, 0).into(),
|
||||
Rgb888::new(24, 24, 24).into(),
|
||||
Rgb888::new(40, 40, 40).into(),
|
||||
Rgb888::new(56, 56, 56).into(),
|
||||
Rgb888::new(71, 71, 71).into(),
|
||||
Rgb888::new(86, 86, 86).into(),
|
||||
Rgb888::new(100, 100, 100).into(),
|
||||
Rgb888::new(113, 113, 113).into(),
|
||||
Rgb888::new(126, 126, 126).into(),
|
||||
Rgb888::new(140, 140, 140).into(),
|
||||
Rgb888::new(155, 155, 155).into(),
|
||||
Rgb888::new(171, 171, 171).into(),
|
||||
Rgb888::new(189, 189, 189).into(),
|
||||
Rgb888::new(209, 209, 209).into(),
|
||||
Rgb888::new(231, 231, 231).into(),
|
||||
Rgb888::new(255, 255, 255).into(),
|
||||
],
|
||||
CardType::Daemon => [
|
||||
Rgb565::new(0, 3, 60),
|
||||
Rgb565::new(96, 0, 136),
|
||||
Rgb565::new(0, 56, 132),
|
||||
Rgb565::new(42, 46, 121),
|
||||
Rgb565::new(0, 82, 96),
|
||||
Rgb565::new(177, 5, 133),
|
||||
Rgb565::new(255, 0, 78),
|
||||
Rgb565::new(172, 41, 206),
|
||||
Rgb565::new(0, 157, 74),
|
||||
Rgb565::new(0, 138, 197),
|
||||
Rgb565::new(78, 110, 168),
|
||||
Rgb565::new(255, 92, 255),
|
||||
Rgb565::new(10, 255, 82),
|
||||
Rgb565::new(0, 247, 255),
|
||||
Rgb565::new(173, 212, 250),
|
||||
Rgb565::new(255, 255, 255),
|
||||
Rgb888::new(0, 3, 60).into(),
|
||||
Rgb888::new(96, 0, 136).into(),
|
||||
Rgb888::new(0, 56, 132).into(),
|
||||
Rgb888::new(42, 46, 121).into(),
|
||||
Rgb888::new(0, 82, 96).into(),
|
||||
Rgb888::new(177, 5, 133).into(),
|
||||
Rgb888::new(255, 0, 78).into(),
|
||||
Rgb888::new(172, 41, 206).into(),
|
||||
Rgb888::new(0, 157, 74).into(),
|
||||
Rgb888::new(0, 138, 197).into(),
|
||||
Rgb888::new(78, 110, 168).into(),
|
||||
Rgb888::new(255, 92, 255).into(),
|
||||
Rgb888::new(10, 255, 82).into(),
|
||||
Rgb888::new(0, 247, 255).into(),
|
||||
Rgb888::new(173, 212, 250).into(),
|
||||
Rgb888::new(255, 255, 255).into(),
|
||||
],
|
||||
CardType::Fairy => [
|
||||
Rgb565::new(40, 40, 46),
|
||||
Rgb565::new(108, 86, 113),
|
||||
Rgb565::new(135, 168, 137),
|
||||
Rgb565::new(249, 130, 132),
|
||||
Rgb565::new(176, 169, 228),
|
||||
Rgb565::new(222, 163, 139),
|
||||
Rgb565::new(172, 204, 228),
|
||||
Rgb565::new(254, 170, 228),
|
||||
Rgb565::new(217, 200, 191),
|
||||
Rgb565::new(255, 195, 132),
|
||||
Rgb565::new(176, 235, 147),
|
||||
Rgb565::new(179, 227, 218),
|
||||
Rgb565::new(233, 245, 157),
|
||||
Rgb565::new(255, 230, 198),
|
||||
Rgb565::new(255, 247, 160),
|
||||
Rgb565::new(255, 255, 255),
|
||||
Rgb888::new(40, 40, 46).into(),
|
||||
Rgb888::new(108, 86, 113).into(),
|
||||
Rgb888::new(135, 168, 137).into(),
|
||||
Rgb888::new(249, 130, 132).into(),
|
||||
Rgb888::new(176, 169, 228).into(),
|
||||
Rgb888::new(222, 163, 139).into(),
|
||||
Rgb888::new(172, 204, 228).into(),
|
||||
Rgb888::new(254, 170, 228).into(),
|
||||
Rgb888::new(217, 200, 191).into(),
|
||||
Rgb888::new(255, 195, 132).into(),
|
||||
Rgb888::new(176, 235, 147).into(),
|
||||
Rgb888::new(179, 227, 218).into(),
|
||||
Rgb888::new(233, 245, 157).into(),
|
||||
Rgb888::new(255, 230, 198).into(),
|
||||
Rgb888::new(255, 247, 160).into(),
|
||||
Rgb888::new(255, 255, 255).into(),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user