LilyPond 'layout' may be changed for 'startRepeatBarType' and 'endRepeatBarType' - I'd like to define various coloured bar types.

Here's an MWE (perhaps not so minimum) showing:
1. colours of 'start/end RepeatBarType' to be red (done in the 'music' and the 'layout' block)
2. colours of repeat with different endings to be red
3. colours of 'Score.VoltaBracket.color' to be red - including the single volta indicators
4. colours of 'sections' to be red
5. colours of 'fine' to be red
6. colours of repeat of a few bars to be magenta

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.26.0"
ColorRepeatSomeBarsBeg = {
    % ColorRepeatAFewBarsStart - Override the barline colour with magenta
    \once \override Score.BarLine.color = #magenta
    % 'glyph' for start of repeat some bars
    \bar ".|:"
}
ColorRepeatSomeBarsEnd = {
    % ColorRepeatAFewBarsEnd - Override the barline colour with Magenta
    \once \override Score.BarLine.color = #magenta
    % 'glyph' for start of repeat some bars
    \bar ":|."
}
music = \relative c' {
    % Global Settings for Colours - volta brackets color red
    \override Score.VoltaBracket.color = #red
    % Shorten the volta bracket(s) to be drawn (to be over one measure only)
     \override Score.VoltaBracket.musical-length = \musicLength 1
    f1
    % BEG Repeat with different endings - Override the barline colour
    \once \override Staff.BarLine.color = #(x11-color 'red)
    % start volta style is now handled by the glyph 'startRepeatBarType'
    \repeat volta 2 {
        g1
        \ColorRepeatSomeBarsBeg
        a1 a1
        \ColorRepeatSomeBarsEnd
        b1
    } % END repeat volta 2
    \alternative {
        \volta 1 {
            c1
            % BEG Repeat with different endings - Override the barline colour
            \once \override Staff.BarLine.color = #(x11-color 'red)
            % end volta style is now handled by the glyph 'endRepeatBarType'
        } % END volta 1
        \volta 2 {
            d1
        } % END volta 2
    } % END alternative
    e1
    % \section barline in red
    \once \override Staff.BarLine.color = #red \section
    f1
    % \fine barline in red
    \once \override Staff.BarLine.color = #red \fine
} % END music \relative c'
\score {
    \music
    \layout {
        \context {
            \Score
                % definition of 'startRepeatBarType'
                startRepeatBarType = "[|:"
                % definition of 'startRepeatBarType'
                endRepeatBarType = ":|]"
        }
    }
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Reply via email to