pub enum Color {
Hex(String),
Rgb(u8, u8, u8),
}Expand description
A color value for QR code rendering.
Used for QrStyle::fg_color and QrStyle::bg_color.
Variants§
Hex(String)
Hex string with # prefix: "#000000" (6-digit) or "#000" (3-digit shorthand).
Rgb(u8, u8, u8)
RGB components (red, green, blue), each 0–255.
Implementations§
Source§impl Color
impl Color
Sourcepub fn to_hex(&self) -> Result<String, QrError>
pub fn to_hex(&self) -> Result<String, QrError>
Resolves the color to a lowercase hex string with # prefix
(e.g. "#1a1a2e").
Three-digit shorthand is expanded ("#fff" becomes "#ffffff").
Returns QrError::InvalidColor if the hex value is malformed
(missing #, wrong length, or non-hex characters).
Trait Implementations§
impl Eq for Color
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnsafeUnpin for Color
impl UnwindSafe for Color
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.