1use azul_core::styled_dom::StyledDom;
2use azul_css::props::basic::color::ColorU;
3
4pub fn coloru_from_str(s: &str) -> ColorU {
5 azul_css::props::basic::color::parse_css_color(s)
6 .ok()
7 .unwrap_or(ColorU::BLACK)
8}
9
10#[cfg(not(feature = "xml"))]
12pub fn styled_dom_from_file(_: &str) -> StyledDom {
13 use azul_core::dom::Dom;
14 use azul_css::css::Css;
15
16 Dom::create_body()
17 .with_children(
18 vec![Dom::create_text(format!(
19 "library was not compiled with --feature=\"xml\""
20 ))]
21 .into(),
22 )
23 .style(Css::empty())
24}
25
26#[cfg(feature = "xml")]
27pub fn styled_dom_from_file(path: &str) -> StyledDom {
28 use crate::xml::XmlComponentMap;
29 crate::xml::domxml_from_file(path, &mut XmlComponentMap::default()).parsed_dom
30}
31
32#[cfg(not(feature = "xml"))]
33pub fn styled_dom_from_str(_: &str) -> StyledDom {
34 use azul_core::dom::Dom;
35 use azul_css::css::Css;
36
37 Dom::create_body()
38 .with_children(
39 vec![Dom::create_text(format!(
40 "library was not compiled with --feature=\"xml\""
41 ))]
42 .into(),
43 )
44 .style(Css::empty())
45}
46
47#[cfg(feature = "xml")]
48pub fn styled_dom_from_str(s: &str) -> StyledDom {
49 use crate::xml::XmlComponentMap;
50 crate::xml::domxml_from_str(s, &mut XmlComponentMap::default()).parsed_dom
51}