1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Node Support Backgrounds}
15
16
17
18
19
20\unprotect
21
22\registerctxluafile{nodebck}{autosuffix}
23
24
25
26
27
28
29
30
31\permanent\def\colorattr#1
32 {\ifcsname\??colorattribute\currentcolorprefix#1\endcsname
33 \node_backgrounds_thecolorattr{\currentcolorprefix#1}
34 \orelse\ifcsname\??colorattribute#1\endcsname
35 \node_backgrounds_thecolorattr{#1}
36 \fi}
37
38\def\node_backgrounds_thecolorattr#1
39 {attr \colormodelattribute \c_attr_colormodel
40 attr \colorattribute \lastnamedcs
41 attr \transparencyattribute \rawtransparencyattribute{#1} }
42
43\permanent\def\thecolorattr#1
44 {attr \colormodelattribute \c_attr_colormodel
45 attr \colorattribute \csname\??colorattribute#1\endcsname
46 attr \transparencyattribute \rawtransparencyattribute{#1} }
47
48\permanent\def\backgroundcolorattr#1
49 {\ifcsname\??colorattribute\currentcolorprefix#1\endcsname
50 \node_backgrounds_thebackgroundcolorattr{\currentcolorprefix#1}
51 \orelse\ifcsname\??colorattribute#1\endcsname
52 \node_backgrounds_thebackgroundcolorattr{#1}
53 \fi}
54
55\permanent\def\thebackgroundcolorattr#1
56 {attr \backgroundattribute \plusone
57 attr \colormodelattribute \c_attr_colormodel
58 attr \colorattribute \csname\??colorattribute#1\endcsname
59 attr \transparencyattribute \rawtransparencyattribute{#1} }
60
61\def\node_backgrounds_thebackgroundcolorattr#1
62 {attr \backgroundattribute \plusone
63 attr \colormodelattribute \c_attr_colormodel
64 attr \colorattribute \lastnamedcs
65 attr \transparencyattribute \rawtransparencyattribute{#1} }
66
67\permanent\def\thealignbackgroundcolorattr#1
68 {attr \alignbackgroundattribute \plusone
69 attr \colormodelattribute \c_attr_colormodel
70 attr \colorattribute \csname\??colorattribute#1\endcsname
71 attr \transparencyattribute \rawtransparencyattribute{#1} }
72
73\permanent\protected\def\backgroundhbox{\node_backgrounds_boxes_add\hbox}
74\permanent\protected\def\backgroundvbox{\node_backgrounds_boxes_add\vbox}
75\permanent\protected\def\backgroundvtop{\node_backgrounds_boxes_add\vtop}
76\permanent\protected\def\backgroundline{\dontleavehmode\node_backgrounds_boxes_add\hbox}
77
78\def\node_backgrounds_boxes_add#1[#2]
79 {\localcontrolled{\clf_enablebackgroundboxes}
80 #1\backgroundcolorattr{#2}}
81
82\protect \endinput
83 |