\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" } }