I have a table of values and I want the cells to range from green to red depending on their values. I tried the following function:
\newcommand{\cellc}[1]{
\pgfmathparse{#1 <= 256 ? #1 / 256 : 1}
\pgfmathsetmacro{\r}{\pgfmathresult}
\pgfmathsetmacro{\g}{1 - \pgfmathresult}
\cellcolor[rgb]{\r ,\g ,0}\r, \g, #1
}
but it just turns every cell green (or red if i flip \r and \g) even when \r is close to one and \g close to 0.
Here's a list of my packages in case it's due to a conflict:
\usepackage{ragged2e}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{float}
\usepackage[table]{xcolor}
\usepackage{slashbox}
\usepackage{diagbox}
\usepackage{fontspec}
\usepackage{tikz}
EDIT: The link with the triangular matrix was actually what I was looking for. Thanks I didn't find it while looking up my problem.
\documentclass
and ending with\end{document}
.