Ok, the "\stopStaff \startStaff" in the colorMusic function is only necessary, if you want to color clefs, for example. In my case there aren't any "clef-changes", so the coloring function can work without it.
It would be nice however, if music with clefs could be colored as well.
I tried to put the "Clef_engraver" from the Staff to the Voice context but that doesn't seem to work well. (attached file)


Nick Payne-3 wrote
If I save the ly file and try to build it (Windows, Lilypond 2.19.21) it causes lilypond to terminate with the error below. I also loaded it into
 Frescobaldi and got the attached Mingw error msgbox:
 [...]

Strange... I'm on Win7 64bit, Frescobaldi & Lilypond 2.19.18 and everything
works fine.

If I comment out the \startStaff and \stopStaff commands (only in the
colorMusic function, not in any ossia voices)...

          \colorGrobs #grob-names #my-color ##t
          %\temporary \override LedgerLineSpanner.color = #my-color
          %\temporary \override Staff.Clef.color = #my-color
          #music
          %\stopStaff
          \colorGrobs #grob-names #my-color ##f
          %\revert LedgerLineSpanner.color
          %\revert Staff.Clef.color
          %\startStaff

...nothing changes (or am I blind?) except for the missing brace that
reappears:
with_stopStaff.pdf
<http://lilypond.1069038.n5.nabble.com/file/n177662/with_stopStaff.pdf>
without_stopStaff.pdf
<http://lilypond.1069038.n5.nabble.com/file/n177662/without_stopStaff.pdf>

Hmmm... no idea :(

Viele Grüße,
Klaus



--
View this message in context: http://lilypond.1069038.n5.nabble.com/Fw-Re-2-coloring-voices-vs-systemStartDelimiterHierarchy-tp177656p177662.html
Sent from the User mailing list archive at Nabble.com.

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
\version "2.19.17"

colorGrob =
#(define-music-function (parser location my-grob my-color color-on)
   (symbol? color? boolean?)
   ;; check for the boolean argument
   (if color-on
       ;; either set the color for the grob type
       #{
         \temporary \override #my-grob #'color = #my-color
       #}
       ;; or revert it
       #{
         \revert #my-grob #'color
         
       #}))

colorGrobs =
#(define-music-function (parser location my-grob-list my-color color-on)
   (symbol-list? color? boolean?)
   (if (null? my-grob-list)
       ;; issue an empty music expression
       #{ #}
       #{
         % color the first grob type of the current list
         \colorGrob #(car my-grob-list) #my-color #color-on
         % recursively call itself with the remainder
         % of the current list.
         \colorGrobs #(cdr my-grob-list) #my-color #color-on
       #}))

colorMusic =
#(let ((grob-names (map car all-grob-descriptions)))
   (define-music-function (parser location my-color music)
     (color? ly:music?)
        #{
          \colorGrobs #grob-names #my-color ##t
          #music
          %\stopStaff
          \colorGrobs #grob-names #my-color ##f
          %\startStaff
          #}))


colA = #(define-music-function(parser location music)(ly:music?)
          #{
            \colorMusic #(rgb-color 0.72 0 0.196) #music
          #})



music = {\repeat unfold 40 a4}

  
  \new StaffGroup {
    <<
    \set StaffGroup.systemStartDelimiterHierarchy =
        #'(SystemStartBar (SystemStartBrace (SystemStartBracket a b)))
        \new Staff {a b c <<\colA {\voiceTwo a a\music \clef tenor \music}\new Voice  \relative c''\colA {\music }>>}
        \new Staff {\music \music}
  >>
}



\layout {
  \context {
    \Staff
    \remove "Clef_engraver"
  }
  \context {
    \Voice
    \consists "Clef_engraver"
  }
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to