Styling for QR Code using theme framework
This commit is contained in:
parent
99a3f25c5f
commit
c2d82833a0
4 changed files with 94 additions and 20 deletions
20
style/src/qr_code.rs
Normal file
20
style/src/qr_code.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
//! Change the appearance of a QR code.
|
||||
use crate::core::Color;
|
||||
|
||||
/// The appearance of a QR code.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct Appearance {
|
||||
/// The color of the QR code data cells
|
||||
pub cell: Color,
|
||||
/// The color of the QR code background
|
||||
pub background: Color,
|
||||
}
|
||||
|
||||
/// A set of rules that dictate the style of a QR code.
|
||||
pub trait StyleSheet {
|
||||
/// The supported style of the [`StyleSheet`].
|
||||
type Style: Default;
|
||||
|
||||
/// Produces the style of a QR code.
|
||||
fn appearance(&self, style: &Self::Style) -> Appearance;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue