TeX - LaTeX Asked on August 9, 2021
I’m looking for a way to change the black to white when using tkz
packages, the ones I use the most are tkz-fct
and tkz-euclide
.
Is there a way of changing the colors of the text, background, fill etc. at will?
documentclass[tikz,border=1cm]{standalone}
usepackage{tkz-fct}
usepackage{mismath}
usepackage{tikz-layers}
begin{document}
begin{tikzpicture}
tkzInit[xmin=-5, xmax=5, ymin=-5, ymax=5]
tkzDrawX[noticks, label=(Releft(zright)),below right,thick]
tkzDrawY[noticks, label=(Imleft(zright)),thick]
tkzDefPoints{0/0/O}tkzLabelPoints[below left](O)
begin{scope}[on background layer]
fill[black,opacity=.2,inner sep=2mm](current bounding box.north west) rectangle (current bounding box.south east);
end{scope}
end{tikzpicture}
end{document}
I've looked over the documentation and found, in tkz-base.cfg
, the lines:
%<------ colors ---------------------------------------–>
deftkz@backgroundcolor{white}
deftkz@textcolor{black}
%<---------------------------------------------------------
deftkz@fillcolor{tkz@backgroundcolor}
deftkz@mainlinecolor{tkz@textcolor}
deftkz@otherlinecolor{tkz@mainlinecolor!50}
We can change these colors by overwriting the definitions in the document. Because the color names contain the @
symbol we need makeatletter
and makeatother
, as follows:
Solution based on Marijn comment
documentclass[tikz,border=1cm]{standalone}
usepackage{tkz-fct}
usepackage{mismath}
usepackage{tikz-layers}
makeatletter
deftkz@textcolor{white}
makeatother
begin{document}
begin{tikzpicture}
tkzInit[xmin=-5, xmax=5, ymin=-5, ymax=5]
tkzDrawX[noticks, label=(Releft(zright)),below right,thick]
tkzDrawY[noticks, label=(Imleft(zright)),thick]
tkzDefPoints{0/0/O}tkzLabelPoints[below left](O)
begin{scope}[on background layer]
fill[black,opacity=.2,inner sep=2mm](current bounding box.north west) rectangle (current bounding box.south east);
end{scope}
end{tikzpicture}
end{document}
Answered by Concept7 on August 9, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP