reveal.js supports a data-background-size field that allows to control how an image or video background is shown.
The default is "cover", which means the slide will be completed covered by the image. Another interesting option is contain, which resizes the image to fit in the slide.
See https://revealjs.com/backgrounds/
As usual a bit in a hurry so I will not submit a PR now, but the change is rather straightforward:
- add a
backgroundSize*: string field in SlideOptions object
- adapt the
slideOptions initialization proc
- adapt the
slideOptionsToAttributes proc. Here is the only tricky part. An if should be added nested both inside the elif options.imageBackground.len > 0 and inside elif options.videoBackground.len > 0 (see code snippet below)
There are also other options that are currently not reachable from nimislides that could be added as well.
For the curious: motivated by this presentation about Advent Of Code (in Italian) that I will be presenting tomorrow at Python Catania meetup. https://github.com/pietroppeter/diventa-avventore-del-codice
code snippet:
elif options.imageBackground.len > 0:
result.add """data-background-image="$1" """ % [options.imageBackground]
if options.backgroundSize.len > 0:
result.add """data-background-size="$1" """ % [options.backgroundSize]
elif options.videoBackground.len > 0:
result.add """data-background-video="$1" """ % [options.videoBackground]
if options.backgroundSize.len > 0:
result.add """data-background-size="$1" """ % [options.backgroundSize]
reveal.js supports a
data-background-sizefield that allows to control how an image or video background is shown.The default is "cover", which means the slide will be completed covered by the image. Another interesting option is contain, which resizes the image to fit in the slide.
See https://revealjs.com/backgrounds/
As usual a bit in a hurry so I will not submit a PR now, but the change is rather straightforward:
backgroundSize*: stringfield inSlideOptionsobjectslideOptionsinitialization procslideOptionsToAttributesproc. Here is the only tricky part. Anifshould be added nested both inside theelif options.imageBackground.len > 0and insideelif options.videoBackground.len > 0(see code snippet below)There are also other options that are currently not reachable from nimislides that could be added as well.
For the curious: motivated by this presentation about Advent Of Code (in Italian) that I will be presenting tomorrow at Python Catania meetup. https://github.com/pietroppeter/diventa-avventore-del-codice
code snippet: