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\permanent\protected\def\negatecolorbox#1
32 {\setbox#1\hpack to \wd#1
33 {\scratchdimen\wd#1\relax
34 \startnegative
35 \blackrule[\c!color=\s!white,\c!height=\ht#1,\c!depth=\dp#1,\c!width=\scratchdimen]
36 \hskip\scratchdimen
37 \leaders\box#1\hfill
38 \stopnegative}}
39
40
41
42
43
44
45
46\installcorenamespace{colorintent}
47
48\permanent\protected\def\registercolorintent#1#2
49 {\edefcsname\??colorintent#1\endcsname{\c_attr_colorintent\clf_registercolorintent{#2}\relax}}
50
51\protected\def\colo_intents_set
52 {\clf_enablecolorintents
53 \protected\gdef\colo_intents_set##1{\csname\??colorintent##1\endcsname}
54 \colo_intents_set}
55
56\registercolorintent{knockout} {knockout}
57\registercolorintent{overprint}{overprint}
58
59\installattributestack\colorintentattribute
60
61\edefcsname\??colorintent\v!none\endcsname{\c_attr_colorintent\attributeunsetvalue}
62
63\permanent\protected\def\startcolorintent[#1]
64 {\pushattribute\colorintentattribute
65 \colo_intents_set{#1}}
66
67\permanent\protected\def\stopcolorintent
68 {\popattribute\colorintentattribute}
69
70\permanent\protected\def\startoverprint{\startcolorintent[\v!overprint]}
71\permanent\protected\def\startknockout {\startcolorintent[\v!knockout ]}
72
73\aliased\let\stopoverprint\stopcolorintent
74\aliased\let\stopknockout \stopcolorintent
75
76\permanent\protected\lettonothing\starttextcolorintent
77\permanent\protected\lettonothing\stoptextcolorintent
78
79\appendtoks
80 \colo_intents_set_text
81\to \everysetupcolors
82
83\lettonothing\p_colo_intent
84
85\def\colo_intents_set_text
86 {\edef\p_colo_intent{\colorsparameter\c!intent}
87 \ifx\p_colo_intent\v!none \else
88 \enforced\protected\xdef\starttextcolorintent{\colo_intents_set{\p_colo_intent}}
89 \glet\colo_intents_set_text\relax
90 \colo_intents_set\p_colo_intent
91 \fi}
92
93\appendtoks \starttextcolorintent \to \everystarttextproperties
94\appendtoks \stoptextcolorintent \to \everystoptextproperties
95
96\setupcolors
97 [\c!intent=\v!none]
98
99\protect \endinput
100 |