# Use siunitx to round numbers while using colortbl to color cells

I typically use the siunitx package to round numbers in tables and use the \cellcolor command of the colortbl package to change the background colors of certain cells. However, as the following example shows, they do not really go together: Only numbers in non-colored cells are rounded correctly; numbers in colored cells are not rounded.

How can I make siunitx to round numbers in the colored cells as well?

\documentclass{beamer}

\usepackage{booktabs}
\usepackage{colortbl}
\usepackage{siunitx}

\begin{document}

\frame{
\centering
\sisetup{
detect-mode,
tight-spacing           = true,
group-digits            = false,
input-signs             = ,
input-symbols           = ,
input-open-uncertainty  = ,
input-close-uncertainty = ,
table-align-text-pre    = false,
round-mode              = places,
round-precision         = 3,
table-space-text-pre    = (,
table-space-text-post   = ),
}
\begin{tabular}{lSS}
\toprule
Cell background & {Number}                        & {Number in parentheses} \\
\midrule
With color      & \cellcolor{yellow!50}-.0399377* & \cellcolor{yellow!50}(.0358997) \\
Without color   & -.030879**                      & (.0203602)                      \\
\bottomrule
\end{tabular}
}

\end{document}


You need to 'hide' the cell colour part from siunitx:
& {\cellcolor{yellow!50}} -.0399377* &

(The package can pick up simple \color commands but not at present \cellcolor ones.)