Latex error: option clash for package xcolor

Original link:https://tex.stackexchange.com/questions/57364/ op-clash-forpackagexcolor
Therefore, the following is just a copy of the above link:

xcolor package is loaded via list. Put the line before \usepackage{listing}. But your preamble is too messy. Most importantly, you call hyperref as the last package and put all the options before geometry fancyhdr.
ucs is irrelevant to your settings.

As Harish wrote \PassOptionsToPackage{svgnames}{xcolor} is fine in \usepackage{listing}, the problem is the same TikZ</ code>. With \PassOptionsToPackage, you can avoid conflicts between options.

Read More: