diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-05-26 17:14:44 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-05-26 17:14:44 +0200 |
| commit | 806d9f0d9ab381500318f3e106b9c20c5eabccb7 (patch) | |
| tree | 7466967220be358c4fd8c5e26f0c3ca501fafa97 /tests/typ/layout | |
| parent | 22214a1e0a79666caefd486e41828f015878ecb0 (diff) | |
Pure functions!
Diffstat (limited to 'tests/typ/layout')
| -rw-r--r-- | tests/typ/layout/stack-1.typ | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/typ/layout/stack-1.typ b/tests/typ/layout/stack-1.typ index 19a00de5..0ecbe246 100644 --- a/tests/typ/layout/stack-1.typ +++ b/tests/typ/layout/stack-1.typ @@ -7,13 +7,14 @@ 30pt, 50%, 20pt, 100%, ) -#let shaded = { - let v = 0% - let next() = { v += 10%; rgb(v, v, v) } - w => rect(width: w, height: 10pt, fill: next()) +#let shaded(i, w) = { + let v = (i + 1) * 10% + rect(width: w, height: 10pt, fill: rgb(v, v, v)) } -#let items = for w in widths { (align(right, shaded(w)),) } +#let items = for i, w in widths { + (align(right, shaded(i, w)),) +} #set page(width: 50pt, margins: 0pt) #stack(dir: btt, ..items) |
