2

Background

I am looking to change the text colour for a document from black to a different dark colour.

Problem

The documentation shows how to change individual colours for a text document, but does not show how to change the base black colour. This includes body text, page numbers, footnotes, headings, table of contents, indices, bibliographies, and so forth.

However, changing the base text colour should not preclude overriding the text colour later on (e.g., to change the heading colour). I would like to override every aspect that uses the default black without having to know or program each aspect individually.

Code

The following fails to set the footnote colour and the table border colour -- and there might be other aspects that use the default black that I don't know about:

\setupcolors[textcolor=red]
\setupinmargin[color=red] 

\starttext
\completecontent

\section{A test}
\inmargin{a test}

\placetable{Caption}
{\bTABLE
\bTR \bTD One \eTD \bTD two \eTD \eTR
\bTR \bTD One \eTD \bTD two \eTD \eTR
\eTABLE}

\input tufte

\section{Another test}
\index{test}Test footnotes\footnote[f]{A footnote test.} and \seeindex{test}{index}indexes.

\page
\placeindex

\stoptext

Question

How do you change the default base black colour throughout the entire document, without having to configure all aspects individually?

Note

ConTeXt should use a single colour that all text inherits. It should then be possible to change that single instance to ensure the new base colour is applied consistently throughout the document.

Related

  • 1
    There is no single interface, I'm afraid. So you'll have to set up each text item individually. That having said, it might be possible to inject the colour information into the font (using Lua). There are font colorschemes, but they don't automatically apply to each text item, which is no better than what you already have. Maybe a wizard comes up with something creative, I'm curious, too. – Marco Jan 14 '14 at 23:30
  • @Marco: Of course there is a simple interface. This is ConTeXt we are talking about :) – Aditya Jan 15 '14 at 21:38
  • @Aditya You're right, there's an interface, but I couldn't get it working, see my comment to your answer. – Marco Jan 15 '14 at 21:55
5

In ConTeXt mkii you need to specify \setupcolors[state=start]. If on the other hand, you are using ConTeXt mkiv, and want to specify a color for the margin, it must be set in the options of said margin, or else it will reset to default. So the margin is set with \setupinmargin[color=red]

The example that follows is with whatever color you want in the document, while keeping the page numbering color.

The second option, which I assume that based in your comment is what you want, will let you specify the color for the whole document.

The third option is with ConTeXt mkiv.

The fourth option is with ConTeXt mkiv in which the margin is set throughout the document by \setupinmargin[line=13]

The fifth example will show you that footnotes are also possible. In the following, we will use ConTeXt mkii to set footnotes throughout the document. To do so, the footnotes must be enclosed within an environment which is set with the command \placelocalfootnotes or else the footnotes won't appear in the document.

The sixth example is also with ConTeXt mkii, in which the \color command will take over. This time around the \color is grouped within the footnote, while the footnote is set in the preamble of the document. The option state=start must be specified, as well as the color option for the margin.



\setupinmargin[location=right,style=slanted,color=red]
\setupcolors[state=start]
\starttext
\startcolor[red] 
\section{A test}
\inmargin{Just a test}
\input tufte 
\input zapf    

\section{Another test}

\input knuth   
a test 
\dorecurse{2}{\input zapf \par \input tufte} 
\stoptext

enter image description here



\setupinmargin[location=right,style=slanted,color=red]
\setupcolors[state=start,textcolor=red]
\starttext

\section{A test} 
\inmargin{a test}adjust your margins to accommodate the type.  
\input tufte 
\input zapf    

\section{Another test}

\input knuth   
a test 
\dorecurse{2}{\input zapf \par \input tufte} 
\stoptext   

enter image description here



\setupcolors[textcolor=red]
\setupinmargin[color=red,style=slanted] 
\starttext 

\section{A test} 
\inmargin{a test} 
\input tufte  
\input zapf      

\section{Another test}  

\input knuth   
a test 
\dorecurse{2}{\input zapf \par \input tufte}  
\stoptext    

enter image description here



\setupcolors[textcolor=red]
\setupinmargin[line=13,color=red,style=slanted,] 

\starttext 
\section{A test} 
\inmargin{a test}

\input tufte  
\input zapf      

\section{Another test}   
\inmargin{another\\ test}
\input knuth   
a test 

\dorecurse{2}{\input zapf \inmargin{ another\\ test\\ of tests} \par \input tufte}    
\stoptext    

enter image description here enter image description here


\setupcolors[state=start,textcolor=red,]
\setupfootnotes[,conversion=Romannumerals,]
\starttext  
\section{A Test}
\dorecurse{2}{\input zapf \par \startlocalfootnotes Nota \footnote[]{Bene}\stoplocalfootnotes \input tufte}

\placelocalfootnotes
\pagebreak
\dorecurse{2}{\input tufte \par \input zapf}

\stoptext

enter image description here


\setupcolors[state=start,textcolor=red]
\setupinmargin[line=23,color=darkgreen,]
\setupfootnotes[color=green]
\starttext

a test\footnote{\red some nonsense text to test it out.}
\dorecurse{4}{\input hawking \footnote{ \darkblue If in 2600 you stacked all the new books being published next to
each other, you would have to move at ninety miles an hour just to
keep up with the end of the line. Of course, by 2600 new artistic
and scientific work will come in electronic forms, rather than as
physical books and paper. Nevertheless, if the exponential growth
continued, there would be ten papers a second in my kind of
theoretical physics, and no time to read them.}}\inright{This artificial \\ Wild West\\ became America's Iliad.}

\stoptext

enter image description here

  • Dave Jarvis based on @Marco comment, you also want the margin in color, if that is the case, see the second option that soon I'll update in the answer. – doed Jan 17 '14 at 22:14
  • @doed: \setupcolors[state=start] is default for mkiv. – Aditya Jan 17 '14 at 23:26
  • @Aditya I was using mkii first, which requires it, so if it is mkiv, then color option was omitted in the setup of the margin. So now should I edit the question to specify both mkii and mkiv? When a question about ConTeXt comes up, it usually does not make the distinction which version of ConTeXt is used. – doed Jan 17 '14 at 23:48
  • @DaveJarvis What did I say? Let me update the answer with yet another example to show you that footnotes also work. – doed Jan 19 '14 at 0:38
  • Rather than using local footnotes, you can also use \setupfootnotes[color=red]. – Aditya Jan 19 '14 at 5:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.