fn template_card_from_unformatted_card()

in src/trello.rs [106:137]


fn template_card_from_unformatted_card(card: &TrelloCard) -> TemplateTrelloCard {
    TemplateTrelloCard {
        name: card.name.to_string(),
        url: card.url.to_string(),
        labels: card
            .labels
            .iter()
            .map(|l| {
                format!(
                    "<span class=\"card-label\" style=\"background-color:{}\"><span>{}</span></span>",
                    match &l.color {
                        Some(c) => match c.as_str() {
                            "green" => "#61bd4f",
                            "yellow" => "#f2d600",
                            "orange" => "#ff9f1a",
                            "red" => "#eb5a46",
                            "purple" => "#c377e0",
                            "blue" => "#0079bf",
                            "sky" => "#00c2e0",
                            "lime" => "#51e898",
                            "pink" => "#ff78cb",
                            "black" => "#344563",
                            _ => "#344563",
                        },
                        None => "",
                    }, &l.name
                )
            })
            .collect::<Vec<String>>()
            .join(" "),
        }
}