mcbanner/lib.rs
1//! # Overview
2//! This library is a simple way to create Minecraft banner images. It uses the [image](https://docs.rs/image/) crate under the hood for the image generation.
3//!
4//! ## Usage
5//! The [Banner] struct is the main entrypoint of the library.
6//! ```rust,no_run
7//! use mcbanner::{Banner, Pattern, MCColor};
8//!
9//! fn main() {
10//! let mut banner = Banner::new(MCColor::Red);
11//! banner.add_pattern(Pattern::Bricks, MCColor::Orange);
12//! banner.render();
13//! banner.save("banner.png").unwrap();
14//! }
15//! ```
16
17mod banner;
18mod patterns;
19mod colors;
20
21pub use banner::Banner;
22pub use patterns::Pattern;
23pub use colors::MCColor;
24
25#[cfg(test)]
26mod test {
27 use crate::Banner;
28
29 #[test]
30 fn test_banner() {
31 let mut banner = Banner::new(crate::colors::MCColor::Red);
32 banner.render();
33 }
34
35 #[test]
36 fn test_banner_with_pattern() {
37 let mut banner = Banner::new(crate::colors::MCColor::Lime);
38 banner.add_pattern(crate::patterns::Pattern::Creeper, crate::colors::MCColor::Black);
39 banner.render();
40 banner.save("banner.png").unwrap();
41 }
42}