Skip to main content

Crate qr_code_styling

Crate qr_code_styling 

Source
Expand description

§QR Code Styling

A Rust library for generating styled QR codes with customizable dots, corners, gradients, and logo embedding.

§Features

  • 6 dot styles (square, dots, rounded, classy, classy-rounded, extra-rounded)
  • 3 corner square styles (square, dot, extra-rounded)
  • 2 corner dot styles (dot, square)
  • Linear and radial gradient support
  • Logo/image embedding with automatic sizing
  • Circle shape support
  • Multiple output formats (SVG, PNG, JPEG, WebP)

§Example

use qr_code_styling::{QRCodeStyling, OutputFormat};
use qr_code_styling::config::{DotsOptions, Color};
use qr_code_styling::types::DotType;

let qr = QRCodeStyling::builder()
    .data("https://example.com")
    .width(300)
    .height(300)
    .dots_options(DotsOptions::new(DotType::Rounded).with_color(Color::rgb(0, 0, 128)))
    .build()
    .unwrap();

// Render as SVG
let svg = qr.render_svg().unwrap();

// Or save to file
// qr.save("qr.png", OutputFormat::Png).unwrap();

Re-exports§

pub use config::BackgroundOptions;
pub use config::Color;
pub use config::ColorStop;
pub use config::CornersDotOptions;
pub use config::CornersSquareOptions;
pub use config::DotsOptions;
pub use config::Gradient;
pub use config::ImageOptions;
pub use config::QRCodeStylingBuilder;
pub use config::QRCodeStylingOptions;
pub use config::QROptions;
pub use core::QRCodeStyling;
pub use error::QRError;
pub use error::Result;
pub use plugins::BorderDecoration;
pub use plugins::BorderOptions;
pub use plugins::BorderPlugin;
pub use plugins::Position;
pub use plugins::QRBorderOptions;
pub use types::CornerDotType;
pub use types::CornerSquareType;
pub use types::DotType;
pub use types::ErrorCorrectionLevel;
pub use types::GradientType;
pub use types::Mode;
pub use types::OutputFormat;
pub use types::ShapeType;

Modules§

config
Configuration types for QR code styling.
core
Core QR code generation and styling.
error
Error types for QR code styling library.
figures
Figure drawing for QR code elements.
plugins
Plugins for extending QR code functionality.
rendering
Rendering modules for QR code output.
types
Type definitions for QR code styling.
utils
Utility functions.