So, i tried to figure out all problems I have with this function at the moment. I'd like to have general Score informations (as TimeSignature, Key, Clefs at the beginning of a line etc.) remain with the standard color (-> black) and all informations regarding a specific Voice (NoteHeads, Stems, Beams, LederLines, Articulations, Dynamics, clef Changes etc.) colored in a custom color. 1. The colored music expression is interrupted by <<{}\\{}>>, so you have to repeat \colorMusic very often (especially in polyphonic music (and especially with "Bach") there are often short areas with added voices, which are rather "extensions" to the main voice than a proper separated voice)

Is there any way "\colorMusic #red {c <<{c} \\ {c}>> c}" works for the entire area?

2. Clefs
If i want to color some music at the beginning of a system, the Clef at the SystemStart gets colored, too.

3. Beams
If the colored area stops in the middle of a beam, the second part of the beam gets colored, while the NoteHeads and Stems remain black as intended. I know, that every Beam is one single object, but is there a possibility to divide such a beam and color only the first part?

4. LedgerLines
I find it strange, that the LedgerLines remain colored...
They should be depend on the color of the NoteHead and if there are more Notes simultaneously (for example <a'' f'''>), the LedgerLines should change their color bottom-up after each NoteHead.



Thank you all very much for your help!
musicus


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
                   \override Staff.Clef #'color = #my-color
                   #music
                   %\stopStaff
                   \colorGrobs #grob-names #my-color ##f
                   \revert Staff.Clef #'color
                   %\startStaff
             #}))


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






\new StaffGroup {
      <<
            \new Staff \relative c''' \repeat unfold 5{
                  \colA {a8 b \clef tenor c d {a c b} a b[ c} \clef treble a a] a a a a a
            }
            \new Staff \relative c'' \repeat unfold 5{
                  \colA {a b c d <<{a c b}\\{a b c}>> a b c}
            }
      >>
}



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

Reply via email to