lilypond-user
[Top][All Lists]
Advanced

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

Re: Change color after a line break


From: Marc Hohl
Subject: Re: Change color after a line break
Date: Sun, 19 Jul 2015 08:40:18 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

Am 17.07.2015 um 18:59 schrieb Marc Hohl:
Hi list,

for strange reasons, I have to color complete lines in different colors.

I found http://lsr.di.unimi.it/LSR/Item?id=443 which works
great for complete scores, but if I call \applyContext ...
after a line break, the color of the Staff lines does not change.
I tried \stopStaff/\startStaff with no visible difference.

How can I change the definition of override-color-for-all-grobs
to make the second staff line completely red?

Thanks in advance,

Marc

%% http://lsr.di.unimi.it/LSR/Item?id=443
%% see also
http://lilypond.org/doc/v2.18/Documentation/learning/visibility-and-color-of-objects


#(define (override-color-for-all-grobs color)
   (lambda (context)
    (let loop ((x all-grob-descriptions))
     (if (not (null? x))
      (let ((grob-name (caar x)))
       (display grob-name)
       (ly:context-pushpop-property context grob-name 'color color)
       (loop (cdr x)))))))

\relative c' {
   \applyContext #(override-color-for-all-grobs (x11-color 'blue))
   c4\pp\< d e f
   \break \stopStaff
   \applyContext #(override-color-for-all-grobs (x11-color 'red))
   \startStaff
   \grace { g16[( a g fis]) } g1\ff\!
}

Addendum:

I am using the bleeding edge self-compiled lilypond version 2.19.24
and tried

#(define (override-color-for-all-grobs color)
  (lambda (context)
   (let loop ((x all-grob-descriptions))
    (if (not (null? x))
     (let ((grob-name (caar x)))
      #{ \override #(list 'Staff grob-name 'color) = #color #}
      (loop (cdr x)))))))

as well as the new overrideProperty command provided by David Kastrup in one of the latest patch series:

#(define (override-color-for-all-grobs color)
  (lambda (context)
   (let loop ((x all-grob-descriptions))
    (if (not (null? x))
     (let ((grob-name (caar x)))
       (overrideProperty (list 'Score grob-name 'color) color)
      (loop (cdr x)))))))

Marc





reply via email to

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