Commits

Anonymous committed 7b1e0c8

improved image frame; configurabe colors

Comments (0)

Files changed (3)

 ready to be employed in the document.
 
 The sample file ``mtext.tex`` shows the default and two further
-motivators in action: ::
+motivators in action. A minimal usage demonstration would look as
+follows ::
 
     \usemodule [motivator]
-
-    \definemotivator [millivator] [image=mill,  maintext=mills]
-    \definemotivator [hackivator] [image=hacker,maintext=\TEX nicians]
+    \definemotivator [mymotivator] [
+      image=mill,
+      maintext=mills,
+      subtext=can’t stop fighting ’em,
+    ]
 
     \starttext
-
-    \motivator
-    \millivator
-    \hackivator
-
-    \stoptext \endinput
-    % vim:ft=context:sw=2:ts=2:expandtab
+    \mymotivator
+    \stoptext
 
 The parameters for ``\setupmotivator`` are:
 
 \usemodule [motivator]
 
-\definemotivator [millivator] [image=mill,  maintext=mills]
-\definemotivator [hackivator] [image=hacker,maintext=\TEX nicians]
+\definemotivator [millivator] [image=mill,maintext=mills]
+\definemotivator [hackivator] [
+  image=hacker,
+  maintext=\TEX nicians,
+  textcolor=darkmagenta,
+  primarycolor=gray,
+  secondarycolor=yellow,
+]
 
 \starttext
 
 \motivator
 
 % \motivator [maintext=mills,image=mill]
-% \motivator [maintext=hackers,image=hacker]
 \millivator
 \hackivator
+\motivator
 
 \stoptext \endinput
 % vim:ft=context:sw=2:ts=2:expandtab
 \unprotect
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                        module initialization
+%                        MODULE INITIALIZATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \startinterface all
-  \setinterfacevariable {motivator} {motivator}
-  \setinterfacevariable {maintext}  {maintext}
-  \setinterfacevariable {subtext}   {subtext}
-  \setinterfacevariable {image}     {image}
+  \setinterfacevariable {motivator}      {motivator}
+  \setinterfacevariable {maintext}       {maintext}
+  \setinterfacevariable {subtext}        {subtext}
+  \setinterfacevariable {image}          {image}
+  \setinterfacevariable {primarycolor}   {primarycolor}
+  \setinterfacevariable {secondarycolor} {secondarycolor}
+  \setinterfacevariable {textcolor}      {textcolor}
 \stopinterface
 
 \definenamespace [motivator] [
 % \showframe
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                          color definitions
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\definecolor [textcolor] [white]
+\definecolor [primary]   [black]
+\definecolor [secondary] [white]
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %                             PAGE LAYOUT
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \setuppapersize[A4,landscape][A4,landscape]
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %              BACKGROUND ARRANGEMENT AND IMAGE PLACEMENT
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\startuniqueMPgraphic{background_base_mp}
+  innerdistance := 1mm ;
+  path inner, outer ;
+  outer := (0,0)
+        -- (OverlayWidth,0)
+        -- (OverlayWidth, OverlayHeight)
+        -- (0, OverlayHeight)
+        -- cycle ;
+  inner := (innerdistance,innerdistance)
+        -- (OverlayWidth-innerdistance,innerdistance)
+        -- (OverlayWidth-innerdistance, OverlayHeight-innerdistance)
+        -- (innerdistance, OverlayHeight-innerdistance)
+        -- cycle ;
+  fill outer withcolor \MPcolor{secondary} ;
+  draw inner withpen pencircle scaled 3pt withcolor \MPcolor{primary} ;
+  setbounds currentpicture to boundingbox OverlayBox ;
+\stopuniqueMPgraphic
+
+\defineoverlay[background_base][\useMPgraphic{background_base_mp}]
+
 \defineframed [background_frame] [
-  background=color,
-  backgroundcolor=white,
-  frame=on,
-  framecolor=red,
+  frame=off,
   rulethickness=2mm,
+  background=background_base,
 ]
 
+
 \def\image_file{mill}
 \def\place_motivator_image{%
   \background_frame{%
     \externalfigure [\image_file] [width=\textwidth,height=\textheight]%
+    % \externalfigure [\image_file] [width=\textwidth,height=\textheight]%
   }%
 }
 
 \defineoverlay [mainpic] [\place_motivator_image]
 
 \setupbackgrounds [state=start]
-\setupbackgrounds [page] [background=color,backgroundcolor=black]
-\setupbackgrounds [text] [
-  background=color,
-  backgroundcolor=white,
-]
+\setupbackgrounds [page] [background=color,backgroundcolor=primary]
 \setupbackgrounds [text] [background=mainpic]
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   \tfd\WORD
 \stopsetups
 
-\definecolor [textcolor] [white]
-% \definecolor     [textcolor] [black]
 \definehighlight [maintext_style] [style=bold,color=textcolor,]
 \definehighlight [subtext_style]  [style=normal,color=textcolor,]
 
 \defineframed [motivator_text_frame] [
   frame=off,
-  % frame=on,
-  % framecolor=blue,
   align=middle,
   voffset=5mm,
   width=\text_box_width,
   \xdef\maintext_text{\motivatorparameter{maintext}}%
   \xdef\subtext_text {\motivatorparameter{subtext}}%
   \xdef\image_file   {\motivatorparameter{image}}%
+  \definecolor [textcolor] [\motivatorparameter{textcolor}]
+  \definecolor [primary]   [\motivatorparameter{primarycolor}]
+  \definecolor [secondary] [\motivatorparameter{secondarycolor}]
   \strut\page[yes]%
 }
 
   \v!maintext=cows,
   \v!subtext={best thing in holland since \CONTEXT},
   \v!image=cow,
+  \v!textcolor=white,
+  \v!primarycolor=black,
+  \v!secondarycolor=white,
 ]
 
 \definemotivator [\v!motivator]