Draft Highlighter API

This commit is contained in:
Héctor Ramón Jiménez 2023-09-17 15:29:14 +02:00
parent 723111bb0d
commit 76dc82e8e8
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
10 changed files with 218 additions and 19 deletions

View file

@ -10,7 +10,7 @@ pub use cosmic_text;
use crate::core::font::{self, Font};
use crate::core::text::Shaping;
use crate::core::Size;
use crate::core::{Color, Size};
use once_cell::sync::OnceCell;
use std::borrow::Cow;
@ -129,3 +129,9 @@ pub fn to_shaping(shaping: Shaping) -> cosmic_text::Shaping {
Shaping::Advanced => cosmic_text::Shaping::Advanced,
}
}
pub fn to_color(color: Color) -> cosmic_text::Color {
let [r, g, b, a] = color.into_rgba8();
cosmic_text::Color::rgba(r, g, b, a)
}