lilypond-user
[Top][All Lists]
Advanced

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

Accidentals not changing colour


From: Evian
Subject: Accidentals not changing colour
Date: Wed, 12 Jun 2013 20:37:28 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

2 years ago I was provided with the following code. The idea 
was to change de colour when having an  accidental. This in the 
new version is not working. 

Can anybody help?

Thanks

________________________________________
\version "2.16.0"
\include "color.ly"

staffViolin = \new Staff {

        \coloraccidentals

.....

}       

\score{
        <<
                \staffViolin
        >>
}

_______________________
color.ly

\version "2.16.0"

#(define (accidentals? note symbol)
(let ((p (ly:music-property note 'pitch)))
(and (ly:pitch? p)
(equal? (ly:pitch-alteration p) symbol))))

coloraccidentals = #(define-music-function (parser location music) (ly:music?)
(music-map
 (lambda (event)
   (if (eq? 'EventChord (ly:music-property event 'name))
       (map (lambda (note)
              (if (accidentals? note SHARP)
                  (ly:music-set-property! note 'tweaks (list (cons 'color 
red))) note)
              (if (accidentals? note FLAT)
                  (ly:music-set-property! note 'tweaks (list (cons 'color 
cyan))) note))
            (ly:music-property event 'elements))) event) music))





reply via email to

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