Hi Jakub,

FWIW, here’s another approach that starts from slurs and goes to note heads.  
(Adapted from some code for tied notes where this works a little more cleanly 
since ties connect to note heads directly rather than to note columns…)  

Unfortunately, this one also doesn’t color notes in the middle of slurs, only 
those on the ends.  And Harm’s code that deals with note heads directly is 
probably better for addressing that.

Cheers,
-Paul


%%%%%%%%%%%%%%%%

\version "2.19.36"

#(define (color-slur-notes grob)
   (let*
    ((right-note-col (ly:spanner-bound grob RIGHT))
     (left-note-col (ly:spanner-bound grob LEFT))
     
     (right-notes (ly:grob-array->list 
                   (ly:grob-object right-note-col 'note-heads)))
     
     (left-notes (ly:grob-array->list
                  (ly:grob-object left-note-col 'note-heads)))
     
     (color-notes (lambda (n) (ly:grob-set-property! n 'color red))))

    ; (display right-notes)(newline)
    
    (for-each color-notes right-notes)
    (for-each color-notes left-notes)
    ))

\score {
  \relative c'' {
    \override Staff.Slur.before-line-breaking = #color-slur-notes
    a a
    a( a)
    a( a a)
  }
}

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

Reply via email to