summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorMartin <mhaug@live.de>2021-03-19 22:36:13 +0100
committerGitHub <noreply@github.com>2021-03-19 22:36:13 +0100
commit6cb9fe9064a037224b6560b69b441b72e787fa94 (patch)
tree9a5474758e37199c7a01c6d22383ede225deab4d /src/library
parent898dc38ec153709929d2513fb9d040dd2c1ce0fe (diff)
Text colors 🦩 (#18)
Diffstat (limited to 'src/library')
-rw-r--r--src/library/font.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/library/font.rs b/src/library/font.rs
index 00fd0e81..0993f7f0 100644
--- a/src/library/font.rs
+++ b/src/library/font.rs
@@ -1,3 +1,4 @@
+use crate::layout::Fill;
use fontdock::{FontStretch, FontStyle, FontWeight};
use super::*;
@@ -15,6 +16,7 @@ use super::*;
/// - Font Stretch: `stretch`, of type `relative`, between 0.5 and 2.0.
/// - Top edge of the font: `top-edge`, of type `vertical-font-metric`.
/// - Bottom edge of the font: `bottom-edge`, of type `vertical-font-metric`.
+/// - Fill color the glyphs: `color`, of type `color`.
/// - Serif family definition: `serif`, of type `font-familiy-list`.
/// - Sans-serif family definition: `sans-serif`, of type `font-familiy-list`.
/// - Monospace family definition: `monospace`, of type `font-familiy-list`.
@@ -62,6 +64,7 @@ pub fn font(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
let stretch = args.get(ctx, "stretch");
let top_edge = args.get(ctx, "top-edge");
let bottom_edge = args.get(ctx, "bottom-edge");
+ let color = args.get(ctx, "color");
let serif = args.get(ctx, "serif");
let sans_serif = args.get(ctx, "sans-serif");
let monospace = args.get(ctx, "monospace");
@@ -105,6 +108,10 @@ pub fn font(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
ctx.state.font.bottom_edge = bottom_edge;
}
+ if let Some(color) = color {
+ ctx.state.font.color = Fill::Color(color);
+ }
+
for (variant, arg) in &[
(FontFamily::Serif, &serif),
(FontFamily::SansSerif, &sans_serif),