summaryrefslogtreecommitdiff
path: root/crates/material_theme/src/qr_code.rs
blob: f93fb7716135fe7835d507faf71ac352c456c617 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use iced_widget::qr_code::{Catalog, Style, StyleFn};

use super::Theme;

impl Catalog for Theme {
    type Class<'a> = StyleFn<'a, Self>;

    fn default<'a>() -> Self::Class<'a> {
        Box::new(default)
    }

    fn style(&self, class: &Self::Class<'_>) -> Style {
        class(self)
    }
}

pub fn default(theme: &Theme) -> Style {
    let surface = theme.colorscheme.surface;

    Style {
        cell: surface.on_surface,
        background: surface.color,
    }
}