Crates.io | userstyles |
lib.rs | userstyles |
version | 0.1.4 |
source | src |
created_at | 2017-08-24 21:11:38.346798 |
updated_at | 2018-09-03 22:19:39.54655 |
description | API bindings for userstyles.org. |
homepage | |
repository | https://github.com/chrisduerr/userstyles-rs |
max_upload_size | |
id | 28889 |
size | 50,162 |
The userstyles.org website does not seem to offer an API anymore. All existing API calls will resolve with a server error (500). Because of this, this crate is deprecated.
Userstyles
provides API bindings for userstyles.org
.
This makes it possible to get styles, their settings and other metadata.
For getting all information about a style you can use get_style
.
use userstyles::get_style;
// Style URL: "https://userstyles.org/styles/37035/github-dark"
let style = get_style(37035);
If you just want to access the css with the default settings you can
use the get_css
method with None
as parameter.
use userstyles::response::Style;
let style = Style::default();
let css = style.get_css(None);
If you are interested in the css, but want to change the settings,
you can also use get_css
. This takes a HashMap
with all keys and values you want to set.
You can get all the available settings from Style.style_settings
.
use userstyles::response::Style;
use std::collections::HashMap;
let style = Style::default();
let mut map = HashMap::new();
map.insert(String::from("ACCENTCOLOR"), String::from("#f00ba2"));
let css = style.get_css(Some(&mut map));