Paul, Thanks. I modified the snippet and was able to get it half-way working. I say half-way because I was not able to get the Stem and the Accidental to change colour, just the NoteHead. Well, not quite. I tried this function on a long music and it changed the colour of the stem here and there - not consistently. Perhaps we are catching the stem after it has already been "printed"? I tried also to set the Stem colour directly, but the grob for the Stem does not seem to have the accidental information.
Here is the code I used: %%%%%%%%%%%%%%%%%%% \version "2.18.2" #(define (color-acci notehead) (let* ((accidental(ly:grob-object notehead 'accidental-grob)) (notecolumn (ly:grob-parent notehead X)) (stem (ly:grob-object notecolumn 'stem))) ; (format #t "head = ~a acci = ~a stem = ~a ?? ~%" notehead accidental stem) (if (ly:grob? accidental) (ly:grob-set-property! stem 'color red)) (if (ly:grob? accidental) (ly:grob-set-property! accidental 'color red)) (if (ly:grob? accidental) red black))) #(define (color-stem stem) (let* ((accidental(ly:grob-object stem 'accidental-grob))) (format #t "acci = ~a stem = ~a ?? ~%" accidental stem) (if (ly:grob? accidental) red black))) \score { \new Staff \relative c' { \override NoteHead.color = #color-acci \override Stem.color = #color-stem c4 b d dis ees f g aes } } %%%%%%%%%%%%%%%%%%%%%%% Here is the output: <http://lilypond.1069038.n5.nabble.com/file/n168111/Color-Acci.jpg> -- View this message in context: http://lilypond.1069038.n5.nabble.com/Accidental-Notes-in-different-colour-tp168088p168111.html Sent from the User mailing list archive at Nabble.com. _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user