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

sile-typesetter / sile / 7232859119

16 Dec 2023 03:49PM UTC coverage: 66.878% (-7.7%) from 74.62%
7232859119

push

github

web-flow
Merge 05d75c2a3 into 8686730e4

0 of 4 new or added lines in 1 file covered. (0.0%)

1201 existing lines in 56 files now uncovered.

10550 of 15775 relevant lines covered (66.88%)

3347.52 hits per line

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

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

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

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

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

UNCOV
19
function package:registerCommands ()
×
20

UNCOV
21
  self:registerCommand("background", function (options, _)
×
UNCOV
22
    options.color = options.color or "white"
×
UNCOV
23
    options.allpages = options.allpages or true
×
UNCOV
24
    outputBackground(options.color)
×
UNCOV
25
    if options.allpages and options.allpages ~= "false" then
×
UNCOV
26
      local oldNewPage = SILE.documentState.documentClass.newPage
×
UNCOV
27
      SILE.documentState.documentClass.newPage = function (self_)
×
28
        local page = oldNewPage(self_)
×
29
        outputBackground(options.color)
×
30
        return page
×
31
      end
32
    end
UNCOV
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}
UNCOV
49
]]
×
50

UNCOV
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