i want to produce a gradient header
i tried this code but it does not produce any result:

\startext
\def\Mystyle#1{\startMPcode
  picture tt ; tt := lmt_outline [
  kind = "path",
  text = "#1",
  ] ;
  fill
      for i within tt : pathpart i && endfor cycle
         withshademethod "linear"
         withshadedirection up
         withshadecolors (red, blue) ;
\stopMPcode
}

\definehead[Myhead][section]
\setuphead[Myhead][
  style=\Mystyle,
]
\startMyhead[title=sample] a sample text \stopMyhead
\stoptext

and the code below works but does not colorize numbers of this heads:
\starttext                                                                      
                                                    
                                                                                
                                                    
\def\Mystyle#1{\startMPcode                                                     
                                                    
  picture tt ; tt := lmt_outline [                                              
                                                    
  kind = "path",                                                                
                                                    
  text = "#1",                                                                  
                                                    
  ] ;                                                                           
                                                    
  fill                                                                          
                                                    
      for i within tt : pathpart i && endfor cycle                              
                                                    
         withshademethod "linear"                                               
                                                    
         withshadedirection up                                                  
                                                    
         withshadecolors (red, blue) ;                                          
                                                    
\stopMPcode                                                                     
                                                    
}                                                                               
                                                    
                                                                                
                                                    
\def\startMysection#1{\startsection[title=\Mystyle{#1}]}                        
                                                    
\def\stopMysection{\stopsection}                                                
                                                    
                                                                                
                                                    
\startMysection{hello}                                                          
                                                    
what is best method?                                                            
                                                    
\stopMysection                                                                  
                                                    
                                                                                
                                                    
\stoptext

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to