Debian Codegraph @

texmf-dist/tex/luatex/farbe/farbe.tex

raw
1 %% farbe.tex
2 %% Copyright 2025 Josef Friedrich
3 %
4 % This work may be distributed and/or modified under the
5 % conditions of the LaTeX Project Public License, either version 1.3c
6 % of this license or (at your option) any later version.
7 % The latest version of this license is in
8 % http://www.latex-project.org/lppl.txt
9 % and version 1.3c or later is part of all distributions of LaTeX
10 % version 2008/05/04 or later.
11 %
12 % This work has the LPPL maintenance status `maintained'.
13 %
14 % The Current Maintainer of this work is Josef Friedrich.
15 %
16 % This work consists of the files farbe.lua, farbe.tex,
17 % and farbe.sty.
18
19 \directlua
20 {
21 if farbe == nil then
22 farbe = require('farbe')
23 end
24 }
25
26 \def\FarbePdfLiteral#1{\csname\string\color@#1\endcsname}
27
28 \def\FarbeImport#1{%
29 \directlua
30 {
31 farbe.import_color('#1', '\FarbePdfLiteral{#1}')
32 }%
33 }
34
35 \def\FarbeColor#1
36 {%
37 \directlua{farbe.Color('#1'):write_pdf_colorstack_node('push')}%
38 }
39
40 \def\FarbeColorEnd
41 {%
42 \directlua{farbe.Color('000'):write_pdf_colorstack_node('pop')}%
43 }
44
45 \def\FarbeTextColor#1#2
46 {%
47 \protect\leavevmode{%
48 \directlua{farbe.Color('#1'):write_pdf_colorstack_node('push')}%
49 #2%
50 \directlua{farbe.Color('#1'):write_pdf_colorstack_node('pop')}%
51 }
52 }
53
54 \def\FarbeBox#1
55 {%
56 \directlua{farbe.Color('#1'):write_box()}%
57 }