[Tex/LaTex] How to change colors in Beamer theme

beamer

I would like to change colors in Beamer theme like Amsterdam (downloaded from the side http://latex.simon04.net the first topic). How can I get on the top instead of dark blue for example red color and instead of light blue green color? I use the headline defined like this

\setbeamertemplate{headline}
{%
  \begin{beamercolorbox}[colsep=1.5pt]{upper separation line head}
  \end{beamercolorbox}
  \begin{beamercolorbox}[ht=1.7ex,dp=1.125ex,%
      leftskip=.3cm,rightskip=.3cm plus1fil]{section in head/foot}
    \vskip2pt\insertsectionnavigationhorizontal{\paperwidth}{}{}
  \end{beamercolorbox}%
  \ifbeamer@theme@subsection%
    \begin{beamercolorbox}[colsep=1.5pt]{middle separation line head}
    \end{beamercolorbox}
    \begin{beamercolorbox}[ht=1.7ex,dp=1.125ex,%
      leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
      \usebeamerfont{subsection in head/foot}\insertsubsectionhead
    \end{beamercolorbox}%
  \fi%
  \begin{beamercolorbox}[colsep=1.5pt]{lower separation line head}
  \end{beamercolorbox}
} \mode <all>

\makeatletter
\DeclareOptionBeamer{compress}{\beamer@compresstrue}
\ProcessOptionsBeamer

Best Answer

\documentclass{beamer}

\mode<presentation>
 {
 \usetheme{Amsterdam}
 \setbeamercolor*{palette secondary}{use=structure,fg=white,bg=red}
 \setbeamercolor*{palette tertiary}{use=structure,fg=white,bg=green}
 }

\usepackage{lipsum}
\begin{document}
 \begin{frame}
   \lipsum
 \end{frame}

\end{document}

Leads to:

enter image description here

But notice Claudio Fiandrino's comment on the other answer.