Le vendredi 28 juillet 2023 à 16:46 +0200, Stephan Schöll a écrit :
> Hi all
>
> In order to ease pitch orientation for novice score readers I'd like to
> highlight the fundamental / key note (tonika) and perhaps the 5th
> throughout an entire piece. The most obvious marking might be by
> coloring the note head (and stem).
>
> In the following MVE I'd like to highlight alle the c's and g's:
>
> \relative c' {
> c4 d e c
> e f g2
> }
That's a good job for a simple callback.
```
\version "2.24.1"
\layout {
\context {
\Score
\override NoteHead.color =
#(lambda (grob)
(let* ((pitch (ly:event-property (event-cause grob) 'pitch))
(semi (modulo (ly:pitch-semitones pitch) 12)))
(cond ((eqv? semi 0)
"red")
((eqv? semi 7)
"blue")
(else "black"))))
}
}
\relative c' { c d e f g f e d c b a g fis g a b c1 }
```
There is a very similar example on
https://extending-lilypond.gitlab.io/fr/extending/backend.html#understanding-callbacks
HTH,
Jean
signature.asc
Description: This is a digitally signed message part
