summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkxl/node-bck.mkxl
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkxl/node-bck.mkxl')
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/node-bck.mkxl80
1 files changed, 80 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-bck.mkxl b/Master/texmf-dist/tex/context/base/mkxl/node-bck.mkxl
new file mode 100644
index 00000000000..b456313df3b
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/node-bck.mkxl
@@ -0,0 +1,80 @@
+%D \module
+%D [ file=node-bck,
+%D version=2009.06.08,
+%D title=\CONTEXT\ Node Macros,
+%D subtitle=Backgrounds,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Node Support / Backgrounds}
+
+%D This is first attempt to replacing backgrounds in a few tables
+%D mechanisms. When used more frequently, we can store the color
+%D spec in the attribute.
+
+\unprotect
+
+\registerctxluafile{node-bck}{autosuffix,optimize}
+
+% \backgroundvbox[green] {\input tufte } \par
+% \backgroundvbox[blue] {\input ward } \par
+% \backgroundvbox[red] {\input knuth } \par
+% \backgroundhbox[yellow]{\rotate[rotation=45]{hello world}} \par
+
+\permanent\def\colorattr#1%
+ {\ifcsname\??colorattribute\currentcolorprefix#1\endcsname
+ \node_backgrounds_thecolorattr{\currentcolorprefix#1}%
+ \orelse\ifcsname\??colorattribute#1\endcsname
+ \node_backgrounds_thecolorattr{#1}%
+ \fi}
+
+\def\node_backgrounds_thecolorattr#1%
+ {attr \colormodelattribute \c_attr_colormodel
+ attr \colorattribute \lastnamedcs
+ attr \transparencyattribute \rawtransparencyattribute{#1} } % can be optimized
+
+\permanent\def\thecolorattr#1%
+ {attr \colormodelattribute \c_attr_colormodel
+ attr \colorattribute \csname\??colorattribute#1\endcsname
+ attr \transparencyattribute \rawtransparencyattribute{#1} } % can be optimized
+
+\permanent\def\backgroundcolorattr#1%
+ {\ifcsname\??colorattribute\currentcolorprefix#1\endcsname
+ \node_backgrounds_thebackgroundcolorattr{\currentcolorprefix#1}%
+ \orelse\ifcsname\??colorattribute#1\endcsname
+ \node_backgrounds_thebackgroundcolorattr{#1}%
+ \fi}
+
+\permanent\def\thebackgroundcolorattr#1%
+ {attr \backgroundattribute \plusone
+ attr \colormodelattribute \c_attr_colormodel
+ attr \colorattribute \csname\??colorattribute#1\endcsname
+ attr \transparencyattribute \rawtransparencyattribute{#1} } % can be optimized
+
+\def\node_backgrounds_thebackgroundcolorattr#1%
+ {attr \backgroundattribute \plusone
+ attr \colormodelattribute \c_attr_colormodel
+ attr \colorattribute \lastnamedcs
+ attr \transparencyattribute \rawtransparencyattribute{#1} } % can be optimized
+
+\permanent\def\thealignbackgroundcolorattr#1%
+ {attr \alignbackgroundattribute \plusone
+ attr \colormodelattribute \c_attr_colormodel
+ attr \colorattribute \csname\??colorattribute#1\endcsname
+ attr \transparencyattribute \rawtransparencyattribute{#1} } % can be optimized
+
+\permanent\protected\def\backgroundhbox{\node_backgrounds_boxes_add\hbox}
+\permanent\protected\def\backgroundvbox{\node_backgrounds_boxes_add\vbox}
+\permanent\protected\def\backgroundvtop{\node_backgrounds_boxes_add\vtop}
+\permanent\protected\def\backgroundline{\dontleavehmode\node_backgrounds_boxes_add\hbox}
+
+\def\node_backgrounds_boxes_add#1[#2]%
+ {\clf_enablebackgroundboxes
+ #1\backgroundcolorattr{#2}}
+
+\protect \endinput