lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Highlight or Cross out measures


From: Klaus Blum
Subject: Re: Highlight or Cross out measures
Date: Mon, 16 Mar 2015 08:48:48 -0700 (MST)

Hi Jay, 

maybe this could help you: 

%
-----------------------------------------------------------------------------
\version "2.18.2"

bgColor =
#(define-music-function (parser location y-lower y-upper color) (number?
number? color?)
   #{\stopStaff
     \override Staff.StaffSymbol $'stencil =
     $(lambda (grob)
        (let* ((staff (ly:staff-symbol::print grob))
               (X-ext (ly:stencil-extent staff X))
               (Y-ext (ly:stencil-extent staff Y)))
          (set! Y-ext (cons
                       (+ (car Y-ext) (+ y-lower 2))
                       (+ (cdr Y-ext) (- y-upper 2))))
          (ly:grob-set-property! grob 'layer -10)
          (ly:stencil-add
           (ly:make-stencil (list 'color color
                              (ly:stencil-expr (ly:round-filled-box X-ext
Y-ext 0))
                              X-ext Y-ext))
           staff)))
     \startStaff
   #})

\relative c' {
  c1
  \bgColor #-2 #2 #yellow
  c1
  \stopStaff \revert Staff.StaffSymbol $'stencil \startStaff
  c1
  \bgColor #-3 #2 #green
  c1
}
%
-----------------------------------------------------------------------------

It's based on the code of snippet 726 which you've already found. 
There has been another thread about that:
http://lilypond.1069038.n5.nabble.com/scheme-problem-colored-background-layers-td169023.html
<http://lilypond.1069038.n5.nabble.com/scheme-problem-colored-background-layers-td169023.html>
  

Cheers, 
Klaus



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Highlight-or-Cross-out-measures-tp173198p173221.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]