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

sile-typesetter / sile / 9409557472

07 Jun 2024 12:09AM UTC coverage: 69.448% (-4.5%) from 73.988%
9409557472

push

github

alerque
fix(build): Distribute vendored compat-5.3.c source file

12025 of 17315 relevant lines covered (69.45%)

6023.46 hits per line

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

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

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

6
function package:registerCommands ()
×
7
   self:registerCommand("color", function (options, content)
×
8
      local color = SILE.types.color(options.color or "black")
×
9
      -- This is a bit of a hack to use a liner.
10
      -- (Due to how the color stack is currently handled)
11
      -- If the content spans multiple lines, and a page break occurs in between,
12
      -- this avoids the color being propagated to other page content.
13
      -- (folio, footnotes, etc.)
14
      SILE.typesetter:liner("color", content, function (box, typesetter, line)
×
15
         SILE.outputter:pushColor(color)
×
16
         box:outputContent(typesetter, line)
×
17
         SILE.outputter:popColor()
×
18
      end)
19
   end, "Changes the active ink color to the color <color>.")
×
20
end
21

22
package.documentation = [[
23
\begin{document}
24
The \autodoc:package{color} package allows you to temporarily change the color of the (virtual) ink that SILE uses to output text and rules.
25
The package provides a \autodoc:command{\color} command which takes one parameter, \autodoc:parameter{color=<color specification>}, and typesets its argument in that color.
26

27
The color specification is one of the following:
28
\begin{itemize}
29
\item{A RGB color in \code{#xxx} or \code{#xxxxxx} format, where \code{x} represents a hexadecimal digit, as often seen in HTML/CSS (\code{#000} is black, \code{#fff} is white, \code{#f00} is red, and so on);}
30
\item{A RGB color as a series of three numeric values between 0 and 255 (e.g. \code{0 0 139} is a dark blue) or as three percentages;}
31
\item{A CMYK color as a series of four numeric values between 0 and 255 or as four percentages;}
32
\item{A grayscale color as a numeric value between 0 and 255;}
33
\item{A (case-insensitive) named color, as one of the 148 keywords defined in the CSS Color Module Level 4. (Named colors resolve to RGB in the actual output.)}
34
\end{itemize}
35

36
So, for example, \color[color=red]{this text is typeset with \autodoc:command{\color[color=red]{…}}}.
37

38
Here is a rule typeset with \autodoc:command{\color[color=#22dd33]}: \color[color=#22dd33]{\hrule[width=120pt,height=0.5pt]}
39
\end{document}
40
]]
×
41

42
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

© 2025 Coveralls, Inc