2

I have a simple table

\documentclass{article}

\usepackage[table]{xcolor}
\usepackage{adjustbox}
\usepackage{booktabs}

\begin{document}

\begin{table}
\rowcolors{2}{}{gray!10}
\centering
\begin{adjustbox}{width=\textwidth}
\begin{tabular}{lrrrrrrrrr}
\toprule
  & A & B & C & D & E & F & G & H & I \\ \midrule
A & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
B & 0 & \cellcolor{green}1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
C & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 \\
D & 1 & 0 & 1 & 1 & 0 & 1 & 0 & 0 & 0 \\
E & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
F & 0 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 \\
G & 1 & 1 & 0 & 1 & 0 & 1 & 1 & 1 & 0 \\
H & 1 & 0 & 1 & 1 & 1 & 0 & 1 & 1 & 1 \\
I & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\
\bottomrule
\end{tabular}
\end{adjustbox}
\end{table}

\end{document}

with result

enter image description here

I think the green color is a bit too much. Is it possible to put transparency on it, so it's not as powerful, but is just discretely highlighting the cell with the green color?

5

You can mix other colors, so for example green!50!black mixes black with it, 50% each. But since you want the green to be lighter, you should mix white.

The command for this is shorter though because it will mix with white by default, so you can write \cellcolor{green!30}, and the resulting color will be 70% white and 30% green.

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.