Setting the background color in Slideshow

The OP asked how to set the background color in Slideshow as it is not obvious.

Matthew replied:

Locally, I’d superimpose a picture onto a color rectangle:

#lang slideshow 

 (define (add-bg p color) 
   (refocus (cc-superimpose 
             (colorize 
              (filled-rectangle (pict-width p) 
                                (pict-height p)) 
              color) 
             p) 
            p)) 

 (add-bg (bt "Hello") "green")

To globally set the background, I’d use that in an assembler:

#lang slideshow 

 (define (add-bg p color) 
   (refocus (cc-superimpose 
             (colorize 
              (filled-rectangle (pict-width p) 
                                (pict-height p)) 
              color) 
             p) 
            p)) 

 (current-slide-assembler 
  (let ([orig (current-slide-assembler)]) 
    (lambda (title sep body) 
      (ct-superimpose 
       (inset (add-bg (inset full-page margin) "green") 
              (- margin)) 
       (orig title sep body))))) 

 (slide #:title "Example" (bt "Hello"))

(via plt)


Leave a Reply

Your email address will not be published. Required fields are marked *