eluze <[email protected]> writes:

> I was quite amazed seeing the result of coloring a few parts of code.
>
> in the first 2 files I just changed the location of the \colorContext
> command. the 1st gives the expected result,


colorContext = #(define-music-function (parser location color) (string?)
#{ \applyContext #(override-color-for-all-grobs (x11-color color))
#})
mus = { a b c d e f g a }

\markup first
\relative {
  \mus
}

\markup second
\relative {
  \colorContext LimeGreen
  \mus
}

> while I don't understand why in the 2nd both get colored.

(basically swap both \relative sections).

\relative does not get the opportunity to start an implied context
before \colorContext runs.  As a result, \colorContext modifies the
Global context, and all grobs of the compilation are interpreted in the
same Global context sequentially.

> far more amazing is the result of the 3rd file where I added one more
> score - namely that also the first score gets colored!

Well, \autochange works by running through the music on its own first.
You use a command override-color-for-all-grobs that I don't actually
know.  I have no idea what it will do, and LilyPond does not appear to
know it.

\autochange uses its own global context for doing this, but depending on
what override-color-for-all-grobs does, this might or might not be good
enough.

> now - is this all expected behavior?

It would be good if you mentioned what override-color-for-all-grobs
actually is.

-- 
David Kastrup


_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to