\version "2.18.2" colorPitch = #(define-music-function (parser location p col) (ly:pitch? color?) #{ \override NoteHead.color = #(lambda (grob) (let ((pitch (ly:event-property (ly:grob-property grob 'cause) 'pitch))) (if (equal? pitch p) col))) #}) upper = \relative c' { c4 d es f } \score { \new Staff \upper \layout { } } \score { \new Staff { \colorPitch #(ly:make-pitch 0 1 0) #green \upper } \layout { } } \score { \new Staff { \colorPitch #(ly:make-pitch 0 2 -1/2) #blue \upper } \layout { } }