From b66634d44f6f79e89da138042e9b8591a1b6cf11 Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Sun, 6 Oct 2024 15:12:50 +0200 Subject: [PATCH] added support for auto color with _note and _par --- src/note.typ | 3 +++ src/participant.typ | 6 +++++- src/sequence.typ | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/note.typ b/src/note.typ index 454d20b..b23355d 100644 --- a/src/note.typ +++ b/src/note.typ @@ -25,6 +25,9 @@ panic("Aligned notes can only be over a participant (got side '" + side + "')") } } + if color == auto { + color = COL-NOTE + } return (( type: "note", side: side, diff --git a/src/participant.typ b/src/participant.typ index d1ec7ef..e396595 100644 --- a/src/participant.typ +++ b/src/participant.typ @@ -13,6 +13,7 @@ "queue", "custom" ) +#let DEFAULT-COLOR = rgb("#E2E2F0") #let _par( name, @@ -20,11 +21,14 @@ from-start: true, invisible: false, shape: "participant", - color: rgb("#E2E2F0"), + color: DEFAULT-COLOR, custom-image: none, show-bottom: true, show-top: true, ) = { + if color == auto { + color = DEFAULT-COLOR + } return (( type: "par", name: name, diff --git a/src/sequence.typ b/src/sequence.typ index 4d2f735..09806dd 100644 --- a/src/sequence.typ +++ b/src/sequence.typ @@ -4,6 +4,9 @@ #import "note.typ" #let get-arrow-marks(sym, color) = { + if sym == none { + return none + } if type(sym) == array { return sym.map(s => get-arrow-marks(s, color)) }