summaryrefslogtreecommitdiff
path: root/src/eval/value.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-12-27 19:23:26 +0100
committerLaurenz <laurmaedje@gmail.com>2020-12-27 19:23:26 +0100
commit750d220bb080be077cd7ede6d18d485b1c3fb0c9 (patch)
tree741bcbf9e286de6433a0677d4bcf8b93d70fb806 /src/eval/value.rs
parentc44ebf876f6ab09fe1629d980efc5c4878a6a5a5 (diff)
Add color enum 🎨
Diffstat (limited to 'src/eval/value.rs')
-rw-r--r--src/eval/value.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/eval/value.rs b/src/eval/value.rs
index 8c98257e..a27e9aa9 100644
--- a/src/eval/value.rs
+++ b/src/eval/value.rs
@@ -7,7 +7,7 @@ use std::rc::Rc;
use fontdock::{FontStretch, FontStyle, FontWeight};
use super::{Args, Dict, Eval, EvalContext, SpannedEntry};
-use crate::color::RgbaColor;
+use crate::color::Color;
use crate::diag::Diag;
use crate::geom::{Dir, Length, Linear, Relative};
use crate::paper::Paper;
@@ -32,8 +32,8 @@ pub enum Value {
Relative(Relative),
/// A combination of an absolute length and a relative value: `20% + 5cm`.
Linear(Linear),
- /// A color value with alpha channel: `#f79143ff`.
- Color(RgbaColor),
+ /// A color value: `#f79143ff`.
+ Color(Color),
/// A string: `"string"`.
Str(String),
/// A dictionary value: `(false, 12cm, greeting="hi")`.
@@ -285,6 +285,7 @@ try_from_match!(Linear["linear"]:
Value::Length(v) => v.into(),
Value::Relative(v) => v.into(),
);
+try_from_match!(Color["color"]: Value::Color(v) => v);
try_from_match!(String["string"]: Value::Str(v) => v);
try_from_match!(SynTree["tree"]: Value::Content(v) => v);
try_from_match!(ValueDict["dictionary"]: Value::Dict(v) => v);