lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accidental Notes in different colour


From: Jay Vara
Subject: Re: Accidental Notes in different colour
Date: Thu, 30 Oct 2014 15:49:35 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]