> If anyone can come up with a nice solution, this should definitely be
> added to the LSR...
I'm not sure this is a nice solution yet, but it is at least a little
easier to manipulate the color mapping and it handles enharmonic
spellings easily. Let me know what you think.
-----Jay
\version "2.11.54"
%Association list of semitones from middle c to colors.
#(define color-mapping
(list
(cons (ly:pitch-semitones (ly:make-pitch 0 0 0)) (x11-color 'blue))
(cons 2 (x11-color 'yellow))
(cons 3 (x11-color 'red))
(cons -1 (x11-color 'green))
(cons 5 (x11-color 'purple))
(cons 7 (x11-color 'cyan))
(cons 8 (x11-color 'ForestGreen))
))
#(define (pitch-to-color pitch)
(let ((color (assv (ly:pitch-semitones pitch) color-mapping)))
(if color (cdr color))))
#(define (color-notehead grob)
(pitch-to-color (ly:event-property (ly:grob-property grob 'cause) 'pitch)))
\score
{
\new Staff \relative c'
{
\override NoteHead #'color = #color-notehead
c8 b d dis ees f g aes
}
}
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user