[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
coloring noteheads different depending on parts
From: |
takmi ikeda |
Subject: |
coloring noteheads different depending on parts |
Date: |
Fri, 19 Apr 2013 18:54:53 +0900 |
i'd like to change coloring by argument. have you any idea?
\version "2.16.0"
#(define-public ((color-notehead . nnn) grob)
(define color-mapping
(vector
(list
(cons (ly:make-pitch 0 0 0) (rgb-color 1 0 0))
(cons (ly:make-pitch 0 4 0) (rgb-color 0 1 0))
)
(list
(cons (ly:make-pitch 0 1 0) (rgb-color 0 1 1))
(cons (ly:make-pitch 0 5 0) (rgb-color 1 0 1))
)
)
)
(define (pitch-to-color pitch)
(let*
(
(vvv (vector-ref color-mapping num)) ;it does not works.
;(vvv (vector-ref color-mapping 0)) ;it works.
(ccc (assoc pitch vvv))
)
(if ccc
(cdr ccc))
)
)
(pitch-to-color
(ly:event-property (event-cause grob) 'pitch))
)
aaa = \relative c' { c8 d e f g a b c }
\score {
<<
\new Staff <<
\override Staff.NoteHead #'color = #(color-notehead 0)
\aaa
>>
\new Staff <<
\override Staff.NoteHead #'color = #(color-notehead 1)
\aaa
>>
>>
}
- coloring noteheads different depending on parts,
takmi ikeda <=