css-image
Rust crate for rendering images from css
Features
Only px units are supported for now.
- width/height
- background-color, color
- font-size, font-family, font-weight, font-style, content, text-align
- margin
- padding
- * selector
- border, border-radius, border-color, border-width, border-style
- multiple selectors
Dependencies
- cairo
Usage
use render;
use ;
let css = r#"
body {
background-color: red;
width: 100px;
height: 100px;
}
"#;
let mut styles = css..unwrap; // Parse css string to Styles for easier access
styles.get_mut.unwrap.content.replace; // Set content of body to "Hello world!"
let images = render.unwrap; // Returns a hashmap of css selector -> Image