While I would strongly suggest that you update to the latest development
version, which can regarded
as very stable, this would work with 2.18.2:
% LilyBin
\version "2.18.2"
highlightOutOfRange = #(define-scheme-function
(parser location color lower upper)
((color? red) ly:pitch? ly:pitch?)
(lambda (grob)
(let* ((cause (ly:grob-property grob 'cause))
(pitch (ly:event-property cause 'pitch)))
(if (or (ly:pitch<? pitch lower) (ly:pitch<? upper pitch))
color black))))
\layout {
\context { \Voice
\override NoteHead.color = \highlightOutOfRange c' c''
}
}
{
\transpose c g, \relative c' { c d e f g a b c }
\transpose c f \relative c' { c d e f g a b c }
}
The three adjustments I made are:
1. (define-scheme-function) does need the (parser location) arguments in
2.18.2.
2.(grob-transformer) does not exist in 2.18.2. This function allows to
obtain the property value the grob already had.
In this particular snippet you could color your note heads blue through
a global override and the
callback would leave it as it is.
As a simple solution for 2.18.2 I set the default note head color (for
notes within the allowed pitch range) to black.
3. \fixed does not exist in 2.18.2.
Regards,
Michael
Am 15.11.2019 um 10:18 schrieb Sandro Santilli:
On Thu, Nov 14, 2019 at 09:09:16AM -0800, Aaron Hill wrote:
\layout {
\context { \Voice
\override NoteHead.color = \highlightOutOfRange c' c''
}
}
I like the highlighting idea! Is it compatible at all with 2.18.2 ?
It seems not to be: http://lilybin.com/166vv7/1
Parsing.../usr/share/lilypond/2.18.2/scm/ly-syntax-constructors.scm:56:23:
In expression (apply (ly:music-function-extract fun) parser ...):
/usr/share/lilypond/2.18.2/scm/ly-syntax-constructors.scm:56:23: Wrong number of
arguments to #<procedure #f (color lower upper)>
--strk;