[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Highlight or Cross out measures
From: |
Jay Anderson |
Subject: |
Re: Highlight or Cross out measures |
Date: |
Mon, 16 Mar 2015 20:52:17 -0700 |
On Mon, Mar 16, 2015 at 8:48 AM, Klaus Blum <address@hidden> wrote:
> 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>
>
Awesome. That worked great. Thanks.
-----Jay