[NTG-context] Presentation sections identified by color and mark

jmmora at us.es jmmora at us.es
Sat Feb 3 22:02:52 CET 2018


Hi, I'm starting a presentation with ConTeXt.

I'd like to visually differentiate each section, so I've come up with 
two complementary approaches to do that:

* Use a different color palette for each section, and
* Mark the progress bar to indicate the start of each section.

I've done an small example (at the end) but:

* Last Subject of a Topic take color from next Topic. (e.g. "Some 
greenB")
* I don't like interactionBar styles provided.

I'd like something like:

|-----|-|-----|--|------
(horizontal line and a vertical line at the begin of each section and a 
vertical line of different color for current position)

other option I like:

######%%@@@@@@HHH&&&&&&&
(each letter represents a color. It's a bar with colors marking size of 
text. So it's a series of color rectangles with colors for each section 
and a vertical line for current position)

The main problems are:

* How can I pass the first page of each section to MetaPost?
* How can I protect background color of SomeGreenB to be green and not 
blue?

Thanks.

-------8< ----- Start example


\usemodule[present-original]
\usemodule[present-common]

\definecolor [PageColor]       [black]
\definecolor [BackgroundColor] [s=.85]
\definecolor [OrnamentColor]   [r=.75]
\definecolor [PositionColor]   [s=.55]

\defineoverlay
   [PageShape][\useMPgraphic{PageShape}]

\startuseMPgraphic{PageShape}
     StartPage ;
         path p ; pair pa, pb ; numeric len ; color contrastcolor ;
         numeric i;
         numeric sections[];
         % simulated load of sections
         sections[0] := 1;
         sections[1] := 4;
         sections[2] := 6;

         pickup pencircle scaled 5pt ;
         p := (100pt,100pt)--(500pt,100pt);
         draw p withcolor \MPcolor{OrnamentColor} ;
         contrastcolor = \MPcolor{PositionColor} ;
         if (RealPageNumber > 0) and (NOfPages > 0):
             len := 1/NOfPages ;
             i := 0;
             forever :
               exitunless known sections[i];

               pa := point(0+len*sections[i]) of p ;
               draw (pa+(0,10pt))--(pa+(0,-10pt)) withcolor 
\MPcolor{OrnamentColor} ;
               i := i + 1;
             endfor ;
             pa := point (0+len*RealPageNumber) of p ;
             %draw (pa+(0,10pt))--(pa+(0,-10pt)) withcolor contrastcolor 
;
             draw pa withpen pencircle scaled 10pt withcolor 
contrastcolor ;
        fi ;
     StopPage ;
\stopuseMPgraphic

\setupbackgrounds
   [text]
   [background={PageShape}]

\starttext

\setupdocument[title={Title},location={Place}]

\startdocument
   \definecolor[BackgroundColor][r=0,g=.7,b=0]
   \startTopic[title={Topic Green}]
     Some text A
     \startSubject[title={Some green 1}]
       more text B
     \stopSubject
     \startSubject[title={Some green 2}]
       more text B
     \stopSubject
   \stopTopic

   \definecolor[BackgroundColor][r=0,g=0,b=0.7]
   \startTopic[title={Topic Blue}]
     Some text C
     \startSubject[title={Some blue}]
       more text D
     \stopSubject
   \stopTopic

   \definecolor[BackgroundColor][r=.7,g=0,b=0]
   \startTopic[title={Topic Red}]
     Some text E
     \startSubject[title={Some Red}]
       more text F
     \stopSubject
   \stopTopic
\stopdocument

\stoptext


More information about the ntg-context mailing list