How can I fill a table cell with different colors? I have tried the diagbox package but it doesn't work as you can see. I am not so much interested in the diagonal line. I only want to separate the cell in two triangles, put text in both triangles and fill them with different colors.
\documentclass{article}
\usepackage{tabularx}
\usepackage{colortbl}
\usepackage{diagbox}
\begin{document}
\begin{tabularx}{8cm}{|X|X|X|X|}
\hline
\diagbox{\cellcolor{red}Time}{\cellcolor{green}Day} & Mon & Tue & Wed\\
\hline
Morning & used & used &\\
\hline
Afternoon & & used & used\\
\hline
\end{tabularx}
\end{document}
Best Answer
With mighty
tikz
andtikzmark
:With
overlay
, it is difficult to set the background. You can draw the nodes once again instead (though it looks ugly)Adjust the
ex
values suitably.