Am Fr., 26. Sept. 2025 um 05:32 Uhr schrieb Werner LEMBERG <[email protected]>:
>
>
> > Is it possible to override properties for a given named context in
> > the layout block.
>
> You want to override properties of *grobs* within a given named
> context, and this is not possible.

Well, that's not entirely true.
You can do:

\score {
   \layout {
     \context {
       \Lyrics
       \applyContext
         #(lambda (ctx)
           (when (string=? (ly:context-id ctx) "testB")
             (ly:context-pushpop-property ctx 'LyricText 'color red)))
     }
   }

   <<
     \context Lyrics = "testA" \lyricmode { test4 lyrics A _ }
     \context Lyrics = "testB" \lyricmode { test4 lyrics B _ }
   >>
}

Iirc, this has drawbacks, though. Tbh, I don't remember details and
I'll not research...

>
> Instead, you can easily create your own context and set up the default
> color of grobs accordingly.  Look up the definition of `VaticanaScore`
> in `ly/engraver-init.ly` for an example.

Yep, using custom-contexts is safe.

Cheers,
  Harm

Reply via email to