-
-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
Description
#import "@preview/tablex:0.0.6": tablex, cellx
#tablex(cellx(fill: gradient.linear(red, green))[Aloha])
Raises the following error:
error: panicked with: "Tablex error: Invalid fill specified (must be either a function (column, row) -> fill, a color, an array of valid fill values, or 'none')."
However, the following diff allows compilation without any issue:
diff --git "a/tablex.typ" "b/tablex.typ"
index a3a1692..661c17e 100644
--- "a/tablex.typ"
+++ "b/tablex.typ"
@@ -17,7 +17,7 @@
#let _array_type = type(())
#let _dict_type = type((a: 5))
#let _str_type = type("")
-#let _color_type = type(red)
+#let _color_types = (type(red), type(gradient.linear(red, blue)))
#let _stroke_type = type(red + 5pt)
#let _length_type = type(5pt)
#let _rel_len_type = type(100% + 5pt)
@@ -462,7 +462,7 @@
convert-length-to-pt(stroke, styles: styles)
} else if type(stroke) in (_rel_len_type, _ratio_type) {
panic(no-ratio-error)
- } else if type(stroke) == _color_type {
+ } else if type(stroke) in _color_types {
1pt
} else if type(stroke) == _stroke_type {
// support:
@@ -920,7 +920,7 @@
}
}
- if cell_fill != none and type(cell_fill) != _color_type {
+ if cell_fill != none and type(cell_fill) not in _color_types {
panic("Tablex error: Invalid fill specified (must be either a function (column, row) -> fill, a color, an array of valid fill values, or 'none').")
}
@@ -1604,7 +1604,7 @@
// -- drawing --
#let parse-stroke(stroke) = {
- if type(stroke) == _color_type {
+ if type(stroke) in _color_types {
stroke + 1pt
} else if type(stroke) in (_length_type, _rel_len_type, _ratio_type, _stroke_type, _dict_type) or stroke in (none, auto) {
stroke
So it seems there is no inherent limitation that prevents gradient fills. Is it possible to include this in the next release?