• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sile-typesetter / sile / 7164400214

11 Dec 2023 07:48AM UTC coverage: 70.893% (-1.3%) from 72.188%
7164400214

push

github

web-flow
chore(deps): Bump DeterminateSystems/nix-installer-action from 8 to 9 (#1928)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

11172 of 15759 relevant lines covered (70.89%)

6742.77 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/packages/background/init.lua
1
local base = require("packages.base")
×
2

3
local package = pl.class(base)
×
4
package._name = "background"
×
5

6
local outputBackground = function (color)
7
  local page = SILE.getFrame("page")
×
8
  local backgroundColor = SILE.color(color)
×
9
  SILE.outputter:pushColor(backgroundColor)
×
10
  SILE.outputter:drawRule(page:left(), page:top(), page:right(), page:bottom())
×
11
  SILE.outputter:popColor()
×
12
end
13

14
function package:_init ()
×
15
  base._init(self)
×
16
  self:loadPackage("color")
×
17
end
18

19
function package:registerCommands ()
×
20

21
  self:registerCommand("background", function (options, _)
×
22
    options.color = options.color or "white"
×
23
    options.allpages = options.allpages or true
×
24
    outputBackground(options.color)
×
25
    if options.allpages and options.allpages ~= "false" then
×
26
      local oldNewPage = SILE.documentState.documentClass.newPage
×
27
      SILE.documentState.documentClass.newPage = function (self_)
×
28
        local page = oldNewPage(self_)
×
29
        outputBackground(options.color)
×
30
        return page
×
31
      end
32
    end
33
  end, "Draws a solid background color <color> on pages after initialization.")
×
34

35
end
36

37
package.documentation = [[
38
\begin{document}
39
\use[module=packages.background]
40
The \autodoc:package{background} package allows you to set the color of the canvas background (by drawing a solid color block the full size of the page on page initialization).
41
The package provides a \autodoc:command{\background} command which requires at least one parameter, \autodoc:parameter{color=<color specification>}, and sets the background of the current and all following pages to that color.
42
If you want to set only the current page background different from the default, use the parameter \autodoc:parameter{allpages=false}.
43
The color specification in the same as specified in the \autodoc:package{color} package.
44

45
\background[color=#e9d8ba,allpages=false]
46

47
So, for example, \autodoc:command{\background[color=#e9d8ba,allpages=false]} will set a sepia tone background on the current page.
48
\end{document}
49
]]
×
50

51
return package
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc