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

2018-02-04 Thread Hans Hagen

On 2/3/2018 10:02 PM, jmm...@us.es wrote:

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?


you need to get the logic ok yourself, something like:

\startuseMPgraphic{PageShape}
StartPage ;
numeric n ; n := \number\nofsubpages ;
numeric m ; m := \number\subpageno ;
if (n > 0) and (m > 0) :
pair pa ;
path p ; p := (100pt,100pt) -- (500pt,100pt) ;
draw p
withpen pencircle scaled 5pt
withcolor "BackgroundColor" ;
for i=0,n-1 :
pa := point(1/n) of p ;
draw (pa + (0,10pt)) -- (pa + (0,-10pt))
withpen pencircle scaled 5pt
withcolor "BackgroundColor" ;
endfor ;
draw point (1/m) of p
withpen pencircle scaled 10pt
withcolor "PositionColor" ;
   fi ;
StopPage ;
\stopuseMPgraphic


* How can I protect background color of SomeGreenB to be green and not 
blue?


just look at the definitions you load ...

\definecolor [MyBackgroundColor] [s=.85]
\setupbackgrounds
  [page]
  [background=color,
   backgroundcolor=MyBackgroundColor]




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
___ 

If your question is of interest to others as well, please add an entry 
to the Wiki!


maillist : ntg-context@ntg.nl / 
http://www.ntg.nl/mailman/listinfo/ntg-context

webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___



--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   

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

2018-02-03 Thread jmmora

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
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___