On 2025-07-22 01:25, Thomas Morley wrote:
Am Mo., 21. Juli 2025 um 23:06 Uhr schrieb Stu McKenzie via LilyPond
User List<[email protected]>:
On 2025-07-18 00:20, Thomas Morley wrote:
Am Fr., 18. Juli 2025 um 06:39 Uhr schrieb Stu McKenzie via LilyPond
User List<[email protected]>:
On 2025-07-17 07:50, Magnus Svenson wrote:
Music = {
b'1
\break % to show colored bar line
\ColorRepeatBegSpecialBar
\repeat volta 2 {
c''1 |
\alternative {
\volta 1 {
d''1 |
\ColorRepeatEndSpecialBar
}
\volta 2 {
e''1 |
}
}
}
}
Thank you Magnus, for your reply. Your new structure certainly clears all of
the warnings.
I removed the "\break" before the color change and it proved your theory that
"lilypond considers them to be the same barline" is correct.
I read somewhere that any repeat should start on a new line if possible, so I would like
to ask others if this feature could be changed by specifying that a bar line before a
"\break" can somehow be left in the default color.
For anyone interested, the full MWE is now:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.24.0"
ColorRepeatBegSpecialBar = {
\once \override Score.BarLine.color = #(x11-color 'orange)
\once \set Score.startRepeatBarType = #"[|:"
}
ColorRepeatEndSpecialBar = {
\once \override Score.BarLine.color = #(x11-color 'orange)
\once \set Score.endRepeatBarType = #":|]"
}
Music = {
b'1
\break % to show colored bar line
\ColorRepeatBegSpecialBar
\repeat volta 2 {
c''1 |
\alternative {
\volta 1 {
d''1 |
\ColorRepeatEndSpecialBar
} % END volta 1
\volta 2 {
e''1 |
} % END volta 2
} % END alternative
} % END repeat volta 2
} % END Music
\score {
\new Staff { \Music }
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Have a look athttps://lsr.di.unimi.it/LSR/Item?id=775
Does it help?
Cheers,
Harm
Thanks for the feedback, Thomas.
I've been trying to use some of the Scheme code from that LSR, but
haven't found a solution yet.
I'll keep trying and let others know if I come up with a solution.
From your posts it is not clear, what color a mid-line repeat-bar
should have. The specified one or default?
Below I code for every "special" BarLine.
The LSR-snippet identifies whether an item is end-of-line, mid-line or
begin-of-line and modifies a grob-property relying on the result.
On a second look, this is possible here as well. Though, it's easier
to rely on the actual 'glyph-name as condition for the color.
Makes for:
\version "2.24.0"
#(define (color-certain-bar-lines color . barlines)
(lambda (grob)
(let ((glyph-name (ly:grob-property grob 'glyph-name)))
(if (member glyph-name barlines)
(ly:grob-set-property! grob 'color color)))))
colorRepeatBegSpecialBar = \once \set Score.startRepeatBarType = "[|:"
colorRepeatEndSpecialBar = \once \set Score.endRepeatBarType = ":|]"
music = {
b'1
\break % to show colored bar line
\colorRepeatBegSpecialBar
\repeat volta 2 {
c''1 |
\alternative {
{ d''1 | \colorRepeatEndSpecialBar }
{ e''1 | }
}
}
}
\score {
\new Staff \music
\layout {
\context {
\Staff
\override BarLine.after-line-breaking =
#(color-certain-bar-lines (x11-color 'orange) "[|:" ":|]")
}
}
}
HTH,
Harm
Yes, Thomas, I didn't make it clear that I wanted a default barline at
the end of the first line.
Your solution provides exactly what I wanted, with the default barline
color at the end of bar 1, and the colored "special" barlines for the
repeating section.
I just wish that I could be a wizard at Scheme code like you, and come
up with solutions to all of the little tweaks that LilyPond allows us to do.
Thank you for your help on this subject.
Now I can get on with finishing my score.
Stu.