[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Accidental Notes in different colour
From: |
Paul Morris |
Subject: |
Re: Accidental Notes in different colour |
Date: |
Fri, 31 Oct 2014 07:26:05 -0700 (PDT) |
Hi Jay, Looks like you got very close! And you are right about the problem:
Jay Vara wrote
> Perhaps we are catching the stem after it has already been "printed"?
To fix this, we can use \override NoteHead.before-line-breaking, which lets
us set the grob properties sooner. The following uses this approach and
seems to work like you want.
Cheers,
-Paul
%%%%%%%%%%%%%%%%%%%
\version "2.18.2"
#(define (color-acci notehead)
(let* ((accidental (ly:grob-object notehead 'accidental-grob))
(notecolumn (ly:grob-parent notehead X))
(stem (ly:grob-object notecolumn 'stem)))
; (format #t "head = ~a acci = ~a stem = ~a ?? ~%" notehead accidental
stem)
(if (ly:grob? accidental)
(begin
(ly:grob-set-property! stem 'color red)
(ly:grob-set-property! accidental 'color red)
(ly:grob-set-property! notehead 'color red)))))
\score {
\new Staff \relative c' {
\override NoteHead.before-line-breaking = #color-acci
c4 b d dis ees f g aes
}
}
%%%%%%%%%%%%%%%%%%%%%%%
--
View this message in context:
http://lilypond.1069038.n5.nabble.com/Accidental-Notes-in-different-colour-tp168088p168119.html
Sent from the User mailing list archive at Nabble.com.