Paul 

Thanks. I modified your snippet and was able to get it to work for the 
note heads. For some reason the stems and accidentals do not work.

I even tried a separate function to set Stem.color - also did not work. 
The stem does not seem to see accidentals.

When I tried the color-acci in my program with many pages of music, it 
behaved strangely. In some places the stem and accidentals did change 
colour. In some other places only the note head. Perhaps, we are 
catching the stem and accidental after they have already been printed in 
some cases? How to get around that?

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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
  }
}

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


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

Reply via email to