Expand description
ANSI terminal color rendering.
Renders QR codes using 24-bit TrueColor ANSI escape codes with half-block characters. Each character represents 2 vertical pixels with independent foreground and background colors.
§Example
use qrcode_core::Color as ModuleColor;
use qrcode_render::{Renderer, ansi::Color};
let modules = [ModuleColor::Dark, ModuleColor::Light, ModuleColor::Light, ModuleColor::Dark];
// Dark modules in black, light modules in white.
let text = Renderer::<Color>::new(&modules, 2, 0).build();
println!("{}", text);
// Custom colors: dark blue on light gray.
let text = Renderer::<Color>::new(&modules, 2, 0)
.dark_color(Color::new(0, 51, 102))
.light_color(Color::new(224, 224, 224))
.build();
println!("{}", text);Structs§
- Canvas
Ansi - Canvas for ANSI terminal rendering.
- Color
- An ANSI TrueColor (24-bit) pixel.