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

sile-typesetter / sile / 9304060604

30 May 2024 02:07PM UTC coverage: 74.124% (-0.6%) from 74.707%
9304060604

push

github

alerque
style: Reformat Lua with stylua

8104 of 11995 new or added lines in 184 files covered. (67.56%)

15 existing lines in 11 files now uncovered.

12444 of 16788 relevant lines covered (74.12%)

7175.1 hits per line

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

88.0
/packages/background/init.lua
1
local base = require("packages.base")
1✔
2

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

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

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

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

35
package.documentation = [[
36
\begin{document}
37
\use[module=packages.background]
38
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).
39
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.
40
If you want to set only the current page background different from the default, use the parameter \autodoc:parameter{allpages=false}.
41
The color specification in the same as specified in the \autodoc:package{color} package.
42

43
\background[color=#e9d8ba,allpages=false]
44

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

49
return package
1✔
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