### Run BigColor Project Demo (Bash) Source: https://github.com/ducflair/bigcolor/blob/main/README.md Instructions on how to navigate to the demo directory and start the web server using `trunk serve`. The demo showcases the capabilities of the BigColor library. ```Bash cd demo trunk serve ``` -------------------------------- ### Calculate Color Contrast and Accessibility Ratios (Rust) Source: https://github.com/ducflair/bigcolor/blob/main/README.md Demonstrates how to use the BigColor library to generate contrasting colors at different intensities and calculate their WCAG contrast ratios against a background color. It also shows how to determine if a color is light or dark. ```Rust use bigcolor::BigColor; fn main() { let background = BigColor::new("#1a6ef5"); // Generate contrast colors with different intensities let low_contrast = background.get_contrast_color(0.2); let medium_contrast = background.get_contrast_color(0.5); let high_contrast = background.get_contrast_color(1.0); // Check contrast ratios (WCAG) let ratio_low = background.get_contrast_ratio(&low_contrast); let ratio_medium = background.get_contrast_ratio(&medium_contrast); let ratio_high = background.get_contrast_ratio(&high_contrast); println!("Background: {}", background.to_hex_string(false)); println!("Low contrast: {} (Ratio: {:.2}:1)", low_contrast.to_hex_string(false), ratio_low); println!("Medium contrast: {} (Ratio: {:.2}:1)", medium_contrast.to_hex_string(false), ratio_medium); println!("High contrast: {} (Ratio: {:.2}:1)", high_contrast.to_hex_string(false), ratio_high); // Check if background is light or dark println!("Is light color: {}", background.is_light()); } ``` -------------------------------- ### Integrate BigColor with Peniko (Rust) Source: https://github.com/ducflair/bigcolor/blob/main/README.md Shows how to convert colors between the BigColor and Peniko::Color formats using the provided conversion utilities. This allows seamless interoperability between the two libraries. ```Rust use bigcolor::{BigColor, conversion}; use peniko::Color as PenikoColor; fn main() { // Convert from BigColor to peniko::Color let big_color = BigColor::new("#1a6ef5"); let peniko_color = conversion::to_peniko_color(&big_color); // Convert from peniko::Color to BigColor let peniko_red = PenikoColor::from_rgb8(255, 0, 0); let big_red = conversion::from_peniko_color(&peniko_red); println!("Original: {}", big_color.to_hex_string(false)); println!("Converted back and forth: {}", big_red.to_hex_string(false)); } ``` -------------------------------- ### Rust: Generate Color Schemes Source: https://github.com/ducflair/bigcolor/blob/main/README.md Illustrates how to generate various color schemes (analogous, monochromatic, triad, tetrad, split complement) from a base color using the BigColor library and print the first color of each scheme. ```Rust use bigcolor::BigColor; fn main() { let color = BigColor::new("#1a6ef5"); // Generate color schemes let analogous = color.analogous(Some(5), Some(30)); let mono = color.monochromatic(Some(5)); let triad = color.triad(); let tetrad = color.tetrad(); let split = color.split_complement(); // Print the first color from each scheme println!("Analogous: {}", analogous[0].to_hex_string(false)); println!("Monochromatic: {}", mono[0].to_hex_string(false)); println!("Triad: {}", triad[0].to_hex_string(false)); println!("Tetrad: {}", tetrad[0].to_hex_string(false)); println!("Split complement: {}", split[0].to_hex_string(false)); } ``` -------------------------------- ### Rust: Create and Convert Colors Source: https://github.com/ducflair/bigcolor/blob/main/README.md Demonstrates how to create BigColor instances from different color formats (hex, RGB, HSL, RGBA) and convert them to other string representations (RGB, HSL, HEX, CMYK). ```Rust use bigcolor::BigColor; fn main() { // Create colors from various formats let hex_color = BigColor::new("#1a6ef5"); let rgb_color = BigColor::new("rgb(255, 0, 0)"); let hsl_color = BigColor::new("hsl(120, 100%, 50%)"); let rgba_color = BigColor::new("rgba(255, 0, 0, 0.5)"); // Convert to different formats println!("As RGB: {}", hex_color.to_rgb_string()); println!("As HSL: {}", rgb_color.to_hsl_string()); println!("As HEX: {}", hsl_color.to_hex_string(false)); println!("As CMYK: {}", rgba_color.to_cmyk_string()); } ``` -------------------------------- ### Rust: Modify Color Properties Source: https://github.com/ducflair/bigcolor/blob/main/README.md Shows how to modify color properties such as lightness, darkness, saturation, and desaturation using the BigColor library. It also demonstrates converting a color to grayscale. ```Rust use bigcolor::BigColor; fn main() { let mut color = BigColor::new("#1a6ef5"); // Modify the color color.lighten(Some(20.0)); // Lighten by 20% println!("Lightened: {}", color.to_hex_string(false)); color = BigColor::new("#1a6ef5"); // Reset color.darken(Some(20.0)); // Darken by 20% println!("Darkened: {}", color.to_hex_string(false)); color = BigColor::new("#1a6ef5"); // Reset color.saturate(Some(20.0)); // Saturate by 20% println!("Saturated: {}", color.to_hex_string(false)); color = BigColor::new("#1a6ef5"); // Reset color.desaturate(Some(20.0)); // Desaturate by 20% println!("Desaturated: {}", color.to_hex_string(false)); color = BigColor::new("#1a6ef5"); // Reset color.greyscale(); // Convert to greyscale println!("Greyscale: {}", color.to_hex_string(false)); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.