Global colour substitution for specific characters in lyrics

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Global colour substitution for specific characters in lyrics

Witold-2

Hello!

I am looking for a way to simplify input in a book of psalms, namely to be able to simply put an * in lyrics and make the character in red.

I tried with #(add-text-replacements!, but it only performs simple character substitution, and I am afraid I am not fluent enough in lilypond to create a function...

\language "deutsch"

transpozycja=c'
akordy={\chordmode{
}}
melodia={
    \key d \minor
        f8 g[ a] a\breve b8 a g a4\bar "|"
        a\breve g8 f g[ a] g[( f e] d4)\bar "|."
}
tekst={\lyricmode{
    Bo -- że, "mój Boże," szu -- kam Cie -- \markup{\concat{"bie " \with-color #(rgb-color 0.894 0.207 0.172) *}}
    "i pragnie Ciebie" mo -- ja du -- sza._*
}}

\score { \transpose c' \transpozycja
    <<
      \chords { \akordy }
      \relative c' { \cadenzaOn \autoBeamOff \melodia }
      \addlyrics { \set stanza = "1." \tekst }
    >>
}

\layout {
    \context { \Lyrics
               \override LyricText.self-alignment-X = #-1
               \override StanzaNumber.font-series = #'medium
               \override StanzaNumber.color = #(rgb-color 0.894 0.207 0.172)
               \override StanzaNumber.font-size = #+1 }
    \context { \ChordNames \germanChords chordNameLowercaseMinor = ##t }
    \context { \Lyrics \consists "Bar_engraver"
                \consists "Separating_line_group_engraver"
                \hide BarLine }
}

Thanks for your help!

-- 
Witold Uchman
Reply | Threaded
Open this post in threaded view
|

Re: Global colour substitution for specific characters in lyrics

Fr. Samuel Springuel
> On 20 May, 2020, at 2:41 AM, Witold Uchman <[hidden email]> wrote:
>
> Hello!
>
> I am looking for a way to simplify input in a book of psalms, namely to be able to simply put an * in lyrics and make the character in red.
>

I define a special function for this:

#(define aster #{ \set stanza = \markup \with-color #gregoriocolor * #})

Given this definition, I can put `\aster` into the lyrics exactly where I want it.


`gregoriocolor` is used in several locations in my files, and has the following definition:

gregoriocolor = #(rgb-color 0.898 0.208 0.172)

You can, of course, change that to the color you actually want.

✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


Reply | Threaded
Open this post in threaded view
|

Re: Global colour substitution for specific characters in lyrics

David Nalesnik
Hi,

On Wed, May 20, 2020 at 8:35 AM Fr. Samuel Springuel
<[hidden email]> wrote:
>
> > On 20 May, 2020, at 2:41 AM, Witold Uchman <[hidden email]> wrote:
> >
> > Hello!
> >
> > I am looking for a way to simplify input in a book of psalms, namely to be able to simply put an * in lyrics and make the character in red.
> >
>

Well, this might be monstrous overkill, but I remember something I
wrote a long long time ago (2012) which could be used:
https://www.mail-archive.com/lilypond-user@.../msg68357.html

The initial problem was to replace many specific Unicode characters
within words with colored versions.

I'm not going to bother making the code more elegant, but I got it to
handle your text.  Note you have to put any character your text
includes in the definition of "all-characters".= or that character
won't appear.  I put in the characters with accents that your text
uses.

For the fun of it, you can add other characters to the definition of
"characters-to-color".

For what it's worth, probably the answer given by Fr. Samuel Springuel
is better for your use case :)

Best,
David Nalesnik

replace.ly (5K) Download Attachment