> On Jul 17, 2015, at 4:24 PM, Timothy Lanfear <[email protected]> wrote:
> 
> I'd like an engraver that changes the colour of the note head if the pitch 
> meets certain conditions.

How about the following?  It shows how to access the pitch and change the 
“default" note head color.  From there you can extend this to change the color 
based on the pitch.

HTH,
-Paul


\version "2.19.22"

colourEngraver = 
#(lambda (context)
   (make-engraver
    (acknowledgers
     ((note-head-interface engraver grob source-engraver)
      (let* ((event (ly:grob-property grob 'cause))
             (pitch (ly:event-property event 'pitch))
             ;; (m (ly:event-property event 'music-cause))
             ;; (tweaks (ly:music-property m 'tweaks))
             )
        
        (display pitch)
        (newline)
        (ly:grob-set-property! grob 'color red)

        ;; (ly:music-set-property! m 'tweaks (assoc-set! tweaks 'color red))
        ;; (display-scheme-music m)
        )))))

\new Staff \with { \consists \colourEngraver }
{
  g'4 \tweak color #blue a' \tweak font-size 0 b'
}


_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to