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

sile-typesetter / sile / 6713098919

31 Oct 2023 10:21PM UTC coverage: 52.831% (-21.8%) from 74.636%
6713098919

push

github

web-flow
Merge d0a2a1ee9 into b185d4972

45 of 45 new or added lines in 3 files covered. (100.0%)

8173 of 15470 relevant lines covered (52.83%)

6562.28 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

8
  self:registerCommand("color", function (options, content)
×
9
    local color = SILE.color(options.color or "black")
×
10
    SILE.typesetter:pushHbox({
×
11
      outputYourself = function () SILE.outputter:pushColor(color) end
×
12
    })
13
    SILE.process(content)
×
14
    SILE.typesetter:pushHbox({
×
15
      outputYourself = function () SILE.outputter:popColor() end
×
16
    })
17
  end, "Changes the active ink color to the color <color>.")
×
18

19
end
20

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

26
The color specification is one of the following:
27
\begin{itemize}
28
\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);}
29
\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;}
30
\item{A CMYK color as a series of four numeric values between 0 and 255 or as four percentages;}
31
\item{A grayscale color as a numeric value between 0 and 255;}
32
\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.)}
33
\end{itemize}
34

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

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

41
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