Debian Codegraph @

texmf-dist/doc/latex/ximera/src/textcolor.dtx

raw
1 % Make \textcolor work using https://tex.stackexchange.com/questions/390127/textcolor-with-tex4ht
2 % \begin{macrocode}
3 %<*cfgXimera>
4 \makeatletter
5 \Configure{textcolor}{\HCode{<span style="color:\#\tsf@color;">}}{\HCode{</span>}}
6 % redefine \textcolor command
7 \let\oldtextcolor\textcolor
8
9 \renewcommand\textcolor[2]{%
10 % we need to convert the current color to hexadecimal form usable in the style attribute
11 % the \tsf@color macro is used in the \Configure{textcolor} configuration to insert the
12 % CSS color
13 \extractcolorspec{#1}{\tsf@color}%
14 \expandafter\convertcolorspec\tsf@color{HTML}\tsf@color%
15 % call the original command
16 \oldtextcolor{#1}{#2}%
17 }%
18 \makeatother
19 %</cfgXimera>
20 % \end{macrocode}