David Kastrup <d...@gnu.org> writes:

> Thomas Morley <thomasmorle...@gmail.com> writes:
>
>>>>>You can write:
>>>>>colorizeDir =
>>>>>#(define-music-function (parser location item)
>>>>>   (symbol-list-or-music?)
>>>>>   (define (grob-colorize-dir grob)
>>>>>     (let ((ev (event-cause grob)))
>>>>>       (case (ly:event-property ev 'direction)
>>>>>             ((1) red)
>>>>>             ((-1) blue)
>>>>>             (else '()))))
>>>>>   #{ \tweak color #grob-colorize-dir #item #})
>>>>
>>>> Thanks, this works perfectly.

Actually, it's oversimplified.  It has to have

(case (and ev (ly:event-property ev 'direction))

or it will bomb out in the cases of coloring grobs not traceable to a
music event.

-- 
David Kastrup


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to