summaryrefslogtreecommitdiffstats
path: root/graphics/src/text.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-17 15:29:14 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-17 15:29:14 +0200
commit76dc82e8e8b5201ec10f8d00d851c1decf998583 (patch)
tree18b48610e48ee90821a2c7678e9ce2f236868f01 /graphics/src/text.rs
parent723111bb0df486bffaedcaed0722b1793d65bfe3 (diff)
downloadiced-76dc82e8e8b5201ec10f8d00d851c1decf998583.tar.gz
iced-76dc82e8e8b5201ec10f8d00d851c1decf998583.tar.bz2
iced-76dc82e8e8b5201ec10f8d00d851c1decf998583.zip
Draft `Highlighter` API
Diffstat (limited to '')
-rw-r--r--graphics/src/text.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/graphics/src/text.rs b/graphics/src/text.rs
index b4aeb2be..5fcfc699 100644
--- a/graphics/src/text.rs
+++ b/graphics/src/text.rs
@@ -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)
+}