On Sun, Apr 28, 2019 at 06:42:05PM +0200, Akim Demaille wrote:
> Actually it works so well that now I wish I could also use
> colors in PDF. I have played with \pdfsetcolor, tweaked
> with whatever seemed relevant in texinfo.tex, but to no
> avail. The Internet offers nothing interesting on "Texinfo
> PDF colors" (except for URLs).
> Even something copied straight from texinfo.tex does not work:
>
> @macro dwarning{text}
> @inlinefmtifelse{tex, @inlineraw{tex, {\setcolor{\linkcolor}}} \text\
> @inlineraw{tex, {\endlink}}, \text\}
> @end macro
This may not work as \linkcolor is black by default.
The following works to put text surrounded by @colorOn{} and @colorOff{}
in a purple colour:
\input texinfo
@tex
\gdef\rgbPurple{0.50 0 0.50}
\gdef\colorOn{%
\setcolor{\rgbPurple}%
}
\gdef\colorOff{%
\setcolor{\maincolor}%
}
@end tex
@ifnottex
@macro colorOn
@end macro
@macro colorOff
@end macro
@end ifnottex
xxx@colorOn{}aaa@colorOff{}bbb
@bye
If you wanted to research it you'd want to look at pdfTeX documentation
as well as the documentation of the PDF format itself:
http://www.adobe.com/devnet/pdf/pdf_reference_archive.html
The colour is set in texinfo.tex with \pdfliteral and the "rg" and "RG"
commands for PDF. These take RGB values with each component being a
number between 0 and 1.