lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Background Colour


From: Jean Abou Samra
Subject: Re: Background Colour
Date: Tue, 18 May 2021 17:03:01 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1


Le 18/05/2021 à 16:38, Lukas-Fabian Moser a écrit :

Seeing the discussion on coloured lyrics, colour this and that, I realized that for some parts I do change the Background Colour of the clefs maually (using a standard ofice yellow marking (grease) pencil each time after an update print. The purpose is to have a fast recognition point for the eyes to jump to the next line and/or page.

How about:

Improved version that only tweaks the stencil after-line-breaking:

\version "2.19"

#(define (positive-number? x) (and (number? x) (positive? x)))

markerPen =
#(define-music-function
  (X-padding Y-padding grob-path)
  ((positive-number? 0.5) (positive-number? 0) key-list?)
  #{
    \override #grob-path .layer = -1
    \override #grob-path .after-line-breaking =
    #(lambda (grob)
       (let*
        ((original (ly:grob-property grob 'stencil))
         (X-ext (ly:stencil-extent original X))
         (Y-ext (ly:stencil-extent original Y)))
        (ly:grob-set-property!
         grob 'stencil
         (ly:stencil-add
          (ly:make-stencil
           (ly:stencil-expr (stencil-with-color
                             (ly:round-filled-box
                              (interval-widen X-ext X-padding)
                              (interval-widen Y-ext Y-padding)
                              1)
                             yellow))
           empty-interval empty-interval)
          original))))
  #})

\new Staff \with {
  \markerPen Clef
}
\relative {
  c'4 d \once\markerPen 0.5 0.5 Accidental es fis
  \once \markerPen Staff.BarLine
  g \markerPen 0.5 0.5 NoteHead g a
}

While this does not solve the problem of the marking affecting inter-system spacing, at least it now works fine for accidentals.


How about a separate grob with engraver? Try the attached.

Is there also a possibility to automatically colour the background in Lilypond, or is there a feature wishlist to which I could add this

You could add it at https://gitlab.com/lilypond/lilypond/-/issues

A variant marking a complete voice in another background colour or only the clef(s) would probably also do.

I have been working on something pretty much like that lately.

Is there a way to make a color glow from an image? I actually need something of that sort for the colored notes.

With the attached code,

\override TheGrob.highlight-me = ##t

\override TheGrob.highlight-details.stencil = #ly:text-interface::print

\override TheGrob.highlight-details.text = \markup \epsfile #X #2.0 "path/to/an/EPS/image.eps"

(Adjust the 2.0 to the desired width.)

Best,
Jean

Attachment: marker.ly
Description: Text Data

Attachment: marker.pdf
Description: Adobe PDF document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]