Remember some information and reflect them in the ToC

You must pass the redefinition of the color to the toc file, e.g.

\documentclass{article}

\usepackage{xcolor}
\colorlet{sectiontoccolor}{black}
\newcommand*{\setsectiontoccolor}[1]{%
    \addtocontents{toc}{\protect\colorlet{sectiontoccolor}{#1}}%
}

\usepackage{titletoc}
\titlecontents{section}%
    [2em]%
    {\bfseries\color{sectiontoccolor}}%
    {\contentslabel{2em}}%
    {\hspace*{-2em}}%
    {\hfill\contentspage}%

\begin{document}

\tableofcontents

\setsectiontoccolor{blue!50!cyan}
\section{BLUE}

\setsectiontoccolor{green!60!black}
\section{GREEN}

\setsectiontoccolor{red}
\section{RED}

\section{STILL RED}

\setsectiontoccolor{black}
\section{BLACK AGAIN}

\end{document}

enter image description here


Quick and dirty

\documentclass[12pt]{article}
\usepackage[a4paper]{geometry}
\usepackage{xcolor}
\newcommand{\nsect}[2]{\addtocontents{toc}{\color{#1}}%
\section{#2}%
\addtocontents{toc}{\color{black}}}
\begin{document}
\tableofcontents
\nsect{blue}{My first section}
\nsect{green}{My second}
\nsect{red}{Third}
\end{document} 

gives

enter image description here