diff options
Diffstat (limited to 'crates/typst-library/src/text')
| -rw-r--r-- | crates/typst-library/src/text/deco.rs | 2 | ||||
| -rw-r--r-- | crates/typst-library/src/text/raw.rs | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/crates/typst-library/src/text/deco.rs b/crates/typst-library/src/text/deco.rs index 4f85abef..6fd56bb6 100644 --- a/crates/typst-library/src/text/deco.rs +++ b/crates/typst-library/src/text/deco.rs @@ -240,7 +240,7 @@ pub struct HighlightElem { /// ```example /// This is #highlight(fill: blue)[with blue]. /// ``` - #[default(Color::Rgba(RgbaColor::new(0xFF, 0xFF, 0x5F, 0xFF)).into())] + #[default(Color::from_u8(0xFF, 0xFF, 0x5F, 0xFF).into())] pub fill: Paint, /// The top end of the background rectangle. diff --git a/crates/typst-library/src/text/raw.rs b/crates/typst-library/src/text/raw.rs index 1f46f94d..688e69d8 100644 --- a/crates/typst-library/src/text/raw.rs +++ b/crates/typst-library/src/text/raw.rs @@ -454,11 +454,12 @@ fn styled(piece: &str, foreground: Paint, style: synt::Style) -> Content { body } -fn to_typst(synt::Color { r, g, b, a }: synt::Color) -> RgbaColor { - RgbaColor { r, g, b, a } +fn to_typst(synt::Color { r, g, b, a }: synt::Color) -> Color { + Color::from_u8(r, g, b, a) } -fn to_syn(RgbaColor { r, g, b, a }: RgbaColor) -> synt::Color { +fn to_syn(color: Color) -> synt::Color { + let [r, g, b, a] = color.to_vec4_u8(); synt::Color { r, g, b, a } } @@ -628,7 +629,7 @@ fn item( synt::ThemeItem { scope: scope.parse().unwrap(), style: synt::StyleModifier { - foreground: color.map(|s| to_syn(s.parse::<RgbaColor>().unwrap())), + foreground: color.map(|s| to_syn(s.parse::<Color>().unwrap())), background: None, font_style, }, |
