Hi Harm, hello list,

unfortunately Yoshiaki-san’s “issue report” regarding whiteout has me coming back to you for help, since I don’t understand the mechanisms of your implementation well enough to start addressing the issue myself.

Are we at the limits of what can sensibly be addressed on LSR-level? Should I create a ticket on implementing background-color and print-color in base LilyPond and have whiteout recognise that appropriately?

Best, Simon

%%%%%%%%%%%%
\version "2.24.0"

\paper {
  background-color = #(x11-color "gray20")
  print-color = "ivory"

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

\layout { }

\markup { Here’s an example of \override #'(color . "green") \whiteout \line { whiteout in markup. } }

{ \override Staff.TimeSignature.whiteout = ##t 1 } \addlyrics { test }
\version "2.24.0"

\paper {
  background-color = #(x11-color "gray20")
  print-color = "ivory"

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

\layout { }

\markup { Here’s an example of \override #'(color . "green") \whiteout \line { whiteout in markup. } }

{ \override Staff.TimeSignature.whiteout = ##t 1 } \addlyrics { test }

Attachment: test-whiteonblack-20250106-whiteout.pdf
Description: Adobe PDF document

Reply via email to