Function css_colors::percent

source ·
pub fn percent(percentage: u8) -> Ratio
Expand description

Construct an ratio from percentages. Values outside of the 0-100% range will cause a panic.

Example

use css_colors::{percent};

assert_eq!(percent(0).to_string(), "0%");
assert_eq!(percent(25).to_string(), "25%");
assert_eq!(percent(100).to_string(), "100%");