Allow to get Color from Analysis
The idea is to use it like this:
let attrs = analysis.extra_attrs();
for attr in attrs {
let class = attr.get_attr_class();
let attr_type = class.get_type();
match attr_type {
AttrType::Foreground => {
let color_attr = pango::AttrColor::from(attr);
let color = color_attr.get_color();
println!("red color {:?}", color.red());
}
_ => {}
}
}
Need a hand in here?
Ok, I updated the code. The Attribute API is a nightmare...
Updated.
I tried to look at code again after long time, and now I can't find way to "get Color from Analysis" 😢 so I prefer postpone PR
You can't, that's the whole point. But at least you can now create all available attributes.
Then maybe remove changes in analysis.rs and Gir.toml.
Or user can do something significant with Vec<Attribute>?
This we have constructors and minimal get/set for Attribute (API really strange) and getters for PangoColor.
That's a good point. The PR as it is now does not even implement what the title says :)