Hello, I need help with a rather obscure problem. But important to me as an educator.
I tried a few places and everybody pointed here.
In Lilypond 2.18 and before, using the colouring scheme from the snippets (
https://t1p.de/b7s8) I was able to colour the (fretboard and) dots of the fretboard with the root note colour. I would simply use the code: \override FretBoard #'color = #color-notehead.
(top part of the attached image)
When I upgraded to Lilypond 2.20, the colour from the dots vanished, replaced by black (as in the bottom part of the image).
I didn't change any of the code.
\version "2.20.0"
\header { title = "Guitar Chords"}
{
%Chords
\storePredefinedDiagram #default-fret-table \chordmode {a}
#guitar-tuning #"o;o;2-2;2-3;2-4;o;"
\storePredefinedDiagram #default-fret-table \chordmode {bes}
#guitar-tuning #"1-1-(;1-1;3-2;3-3;3-4;1-1-);"
\storePredefinedDiagram #default-fret-table \chordmode {c}
#guitar-tuning #"3-3;3-4;2-2;o;1-1;o;"
}
%Colour map
#(define color-mapping
(list
(cons (ly:make-pitch 0 0 NATURAL) (x11-color 'red3))
(cons (ly:make-pitch 0 5 NATURAL) (x11-color 'blue3))
(cons (ly:make-pitch 0 6 FLAT) (x11-color 'magenta3))
)
)
%Compare pitch and alteration (not octave).
#(define (pitch-equals? p1 p2)
(and
(= (ly:pitch-alteration p1) (ly:pitch-alteration p2))
(= (ly:pitch-notename p1) (ly:pitch-notename p2))))
#(define (pitch-to-color pitch)
(let ((color (assoc pitch color-mapping pitch-equals?)))
(if color
(cdr color))))
#(define (color-notehead grob)
(pitch-to-color
(ly:event-property (event-cause grob) 'pitch)))
chordNames = \chordmode { a2 bes c }
\score {
<<
\new ChordNames \chordNames
\new FretBoards
{ \override FretBoards.FretBoard #'size = #'2.0
\override FretBoard #'(fret-diagram-details finger-code) = #'in-dot
\override FretBoard #'(fret-diagram-details orientation) = #'portrait
%This command changes the colour of the fretboard (and used to change the dots in 2.18)
\override FretBoard #'color = #color-notehead
\chordNam
fb.com/viktor.master.uk es
}
>>
}