1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Color Macros Extras}
15
16\unprotect
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32\unexpanded\def\negatecolorbox#1
33 {\setbox#1\hpack to \wd#1
34 {\scratchdimen\wd#1\relax
35 \startnegative
36 \blackrule[\c!color=\s!white,\c!height=\ht#1,\c!depth=\dp#1,\c!width=\scratchdimen]
37 \hskip\scratchdimen
38 \leaders\box#1\hfill
39 \stopnegative}}
40
41
42
43
44
45
46
47\installcorenamespace{colorintent}
48
49\unexpanded\def\registercolorintent#1#2
50 {\setevalue{\??colorintent#1}{\c_attr_colorintent\clf_registercolorintent{#2}\relax}}
51
52\unexpanded\def\colo_intents_set
53 {\clf_enablecolorintents
54 \unexpanded\gdef\colo_intents_set##1{\csname\??colorintent##1\endcsname}
55 \colo_intents_set}
56
57\registercolorintent{knockout} {knockout}
58\registercolorintent{overprint}{overprint}
59
60\installattributestack\colorintentattribute
61
62\setevalue{\??colorintent\v!none}{\c_attr_colorintent\attributeunsetvalue}
63
64\unexpanded\def\startcolorintent[#1]
65 {\pushattribute\colorintentattribute
66 \colo_intents_set{#1}}
67
68\unexpanded\def\stopcolorintent
69 {\popattribute\colorintentattribute}
70
71\unexpanded\def\startoverprint{\startcolorintent[\v!overprint]}
72\unexpanded\def\startknockout {\startcolorintent[\v!knockout ]}
73
74\let\stopoverprint\stopcolorintent
75\let\stopknockout \stopcolorintent
76
77\let\starttextcolorintent\relax
78\let\stoptextcolorintent \relax
79
80\appendtoks
81 \colo_intents_set_text
82\to \everysetupcolors
83
84\let\p_colo_intent\empty
85
86\def\colo_intents_set_text
87 {\edef\p_colo_intent{\colorsparameter\c!intent}
88 \ifx\p_colo_intent\v!none \else
89 \unexpanded\xdef\starttextcolorintent{\colo_intents_set{\p_colo_intent}}
90 \glet\colo_intents_set_text\relax
91 \colo_intents_set\p_colo_intent
92 \fi}
93
94\appendtoks \starttextcolorintent \to \everystarttextproperties
95\appendtoks \stoptextcolorintent \to \everystoptextproperties
96
97\setupcolors
98 [\c!intent=\v!none]
99
100\protect \endinput
101 |