[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting back the dynamically coloured freboard dots on L2.20
From: |
Thomas Morley |
Subject: |
Re: Getting back the dynamically coloured freboard dots on L2.20 |
Date: |
Tue, 3 Nov 2020 23:18:02 +0100 |
Am Di., 3. Nov. 2020 um 22:45 Uhr schrieb Viktor Mastoridis
<viktor.mastoridis@gmail.com>:
>>
>>
>> A minimal would look like:
>> \new FretBoards { \override FretBoard.color = #red a }
>> Changing dot-color in 2.18. but not with 2.20.
>>
>> Investigating...
>>
>> Cheers,
>> Harm
>
>
> Agreed.
> I'm sorry.
> It's the first time I'm posting on this kind/level of forum.
>
First bad commit is:
commit 5e3dc2111d63342ec00ecae8f3a1e38961349a1f
Author: Thomas Morley <thomasmorley65@gmail.com>
Date: Mon May 26 23:44:30 2014 +0200
Color and/or parenthesize single dots in fret-diagrams
Issue 2752
Makes it possible to color and/or parenthesize single dots in
fret-diagram-verbose
Introducing two properties for use in fret-diagram-details
- fret-label-horizontal-offset
affecting the fret-label-indication, like the existing
`fret-label-vertical-offset'
- paren-padding
affecting the padding of the parenthesis
Extending relevant reg-tests.
Documenting it in NR, fretted-strings.itely
Well, so it's my own patch...
The patch introduces many nice features, among them coloring dots.
Alas, one cannot access the grob-color (if it is the return-value of a
procedure) in a reasonable way to use it as a fallback if dot-color is
unset. I have to think about it...
For now the following works:
%start of 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) 'red3)
(cons (ly:make-pitch 0 5 NATURAL) 'blue3)
(cons (ly:make-pitch 0 6 FLAT) '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)
(x11-color
(pitch-to-color
(ly:event-property (event-cause grob) 'pitch))))
#(define (color-dot 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
\override FretBoards.FretBoard #'color = #color-notehead
\override FretBoards.FretBoard.before-line-breaking =
#(lambda (grob)
(ly:grob-set-nested-property! grob '(fret-diagram-details dot-color)
(color-dot grob)))
\chordNames
}
>>
}
%end of code
Cheers,
Harm
- Getting back the dynamically coloured freboard dots on L2.20, Viktor Mastoridis, 2020/11/03
- Re: Getting back the dynamically coloured freboard dots on L2.20, Thomas Morley, 2020/11/03
- Re: Getting back the dynamically coloured freboard dots on L2.20, Viktor Mastoridis, 2020/11/03
- Re: Getting back the dynamically coloured freboard dots on L2.20,
Thomas Morley <=
- Re: Getting back the dynamically coloured freboard dots on L2.20, Carl Sorensen, 2020/11/03
- Re: Getting back the dynamically coloured freboard dots on L2.20, Thomas Morley, 2020/11/03
- Re: Getting back the dynamically coloured freboard dots on L2.20, Thomas Morley, 2020/11/04
- FretBoards require X11 color names, Aaron Hill, 2020/11/04
- Re: FretBoards require X11 color names, Thomas Morley, 2020/11/04
- Re: Getting back the dynamically coloured freboard dots on L2.20, Viktor Mastoridis, 2020/11/05
Re: Getting back the dynamically coloured freboard dots on L2.20, David Wright, 2020/11/03