Skip to main content

qr_code_styling/
lib.rs

1//! # QR Code Styling
2//!
3//! A Rust library for generating styled QR codes with customizable dots,
4//! corners, gradients, and logo embedding.
5//!
6//! ## Features
7//!
8//! - 6 dot styles (square, dots, rounded, classy, classy-rounded, extra-rounded)
9//! - 3 corner square styles (square, dot, extra-rounded)
10//! - 2 corner dot styles (dot, square)
11//! - Linear and radial gradient support
12//! - Logo/image embedding with automatic sizing
13//! - Circle shape support
14//! - Multiple output formats (SVG, PNG, JPEG, WebP)
15//!
16//! ## Example
17//!
18//! ```rust
19//! use qr_code_styling::{QRCodeStyling, OutputFormat};
20//! use qr_code_styling::config::{DotsOptions, Color};
21//! use qr_code_styling::types::DotType;
22//!
23//! let qr = QRCodeStyling::builder()
24//!     .data("https://example.com")
25//!     .width(300)
26//!     .height(300)
27//!     .dots_options(DotsOptions::new(DotType::Rounded).with_color(Color::rgb(0, 0, 128)))
28//!     .build()
29//!     .unwrap();
30//!
31//! // Render as SVG
32//! let svg = qr.render_svg().unwrap();
33//!
34//! // Or save to file
35//! // qr.save("qr.png", OutputFormat::Png).unwrap();
36//! ```
37
38pub mod config;
39pub mod core;
40pub mod error;
41pub mod figures;
42pub mod plugins;
43pub mod rendering;
44pub mod types;
45pub mod utils;
46
47// Re-export main types at crate root for convenience
48pub use config::{
49    BackgroundOptions, Color, ColorStop, CornersDotOptions, CornersSquareOptions, DotsOptions,
50    Gradient, ImageOptions, QRCodeStylingBuilder, QRCodeStylingOptions, QROptions,
51};
52pub use core::QRCodeStyling;
53pub use error::{QRError, Result};
54pub use plugins::{BorderDecoration, BorderOptions, BorderPlugin, Position, QRBorderOptions};
55pub use types::{
56    CornerDotType, CornerSquareType, DotType, ErrorCorrectionLevel, GradientType, Mode,
57    OutputFormat, ShapeType,
58};