Skip to content

Commit 8646e3c

Browse files
committed
Export parse_color_keyword for use in legacy HTML color parsing.
I could have gotten around the privacy restriction by synthesizing a fake CSS AST and parsing that, but that would have been less efficient.
1 parent 2d0c04f commit 8646e3c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/color.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl Color {
6161

6262

6363
#[inline]
64-
fn parse_color_keyword(value: &str) -> Result<Color, ()> {
64+
pub fn parse_color_keyword(value: &str) -> Result<Color, ()> {
6565
let lower_value = value.to_ascii_lower();
6666
let (r, g, b) = match lower_value.as_slice() {
6767
"black" => (0., 0., 0.),

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub use parser::{parse_stylesheet_rules, StylesheetParser,
2121
parse_declaration_list, DeclarationListParser,
2222
parse_one_rule, parse_one_declaration, parse_one_component_value};
2323
pub use from_bytes::{decode_stylesheet_bytes, parse_stylesheet_rules_from_bytes};
24-
pub use color::{RGBA, Color, CurrentColor, RGBAColor};
24+
pub use color::{RGBA, Color, CurrentColor, RGBAColor, parse_color_keyword};
2525
pub use nth::parse_nth;
2626
pub use serializer::{ToCss, serialize_identifier, serialize_string};
2727

0 commit comments

Comments
 (0)