Fantastic!! Thank you very much...

    Le jeudi 2 janvier 2025 à 22:42:35 UTC+1, Thomas Morley 
<thomasmorle...@gmail.com> a écrit :  
 
 Am Do., 2. Jan. 2025 um 21:16 Uhr schrieb Simon Albrecht
<simon.albre...@mail.de>:
>
> Good point! I had forgotten to address that, as well as the naming of
> the paper variables.
>
> I think it’s confusing to set the “foreground colour” via `page-color`,
> since that suggests affecting the colour of the background itself. Hence
> my proposal of `print-color` for the “foreground”.
>
> Revised file attached. I ended up with a weird special-case treatment
> for X11 colours in my `\color-sample` markup function, and realised just
> now that this doesn’t help anyone wanting finer control and RGB color
> values. Oh well, I’ve spent enough time on this for now…
>
> In case I don’t hear back, I’ll probably add it to the LSR.
>
> Best, Simon
>
> On 02.01.25 16:47, Ya Gloops wrote:
> > Hello and Happy New Year!
> > Is it possible to change the background color?
> > For example
> > background-color = #red
> >
> >
> > Le jeudi 2 janvier 2025 à 16:32:17 UTC+1, Simon Albrecht
> > <simon.albre...@mail.de> a écrit :
> >
> >
> > Hi Harm,
> >
> > On 01.01.25 14:00, Thomas Morley wrote:
> > > This should always give a black background, all other objects should
> > > be colored with `page-color`, apart from objects which already have a
> > > color.
> >
> > this is great! How about the attached file for an LSR snippet? Do you
> > want to upload it yourself?
> >
> >
> > Best, Simon

This should work with all kinds of colors (not tested, though):

\paper {
  page-color = "navajowhite"
  page-background-color = #'(0.7 0.7 0.7)

  #(define (page-post-process layout pages)
    (let ((page-color (ly:output-def-lookup $defaultpaper 'page-color #f))
          (page-background-color
            (ly:output-def-lookup $defaultpaper 'page-background-color #f)))
      (for-each
        (lambda (page)
          (let ((page-stencil (ly:prob-property page 'stencil)))
            (set! (ly:prob-property page 'stencil)
              (if (not page-background-color)
                  (stencil-with-color page-stencil page-color)
                  (ly:stencil-add
                    (stencil-with-color
                      (make-filled-box-stencil
                        (ly:stencil-extent page-stencil X)
                        (ly:stencil-extent page-stencil Y))
                      page-background-color)
                    (stencil-with-color page-stencil page-color))))))
        pages)))
}

Please add it to LSR, if you want. I've too much on my lily-todo-list
and my winter-breaks ends soon...

Cheers,
  Harm

  

Reply via email to