I need to change the sections, subsections, etc., styles. And I did. The problem is I need the table of contents to keep the default style.
The text colour in my new style is white, so the TOC appears to have no section titles. And the tocloft
\renewcommand\cftsecfont{\color{black}}
is not overriding that change for the TOC.
\documentclass{article}
\usepackage{xcolor}
\usepackage{tcolorbox}
\usepackage{tocloft}
\renewcommand\cftsecfont{\color{black}}
\newcommand*{\newSection}[1]{
\begin{tcolorbox}[
center title,
left=0pt,
right=0pt,
top=0pt,
bottom=0pt,
colback=blue!75,
colframe=white,
width=\dimexpr\textwidth\relax,
enlarge left by=0mm,
boxsep=5pt,
arc=0pt,outer arc=0pt]
\section{\textcolor{white}{#1}}
\end{tcolorbox}
}
\let\oldthesection\thesection
\renewcommand{\thesection}{\textcolor{white}{\oldthesection}}
\begin{document}
\tableofcontents
\newSection{Section}
\newSection{Another Section}
\newSection{And One More}
\end{document}