I don't think what you're asking is possible (edit: perhaps not directly, but see percusse's answer). The pgfplots manual section 4.7.5 Colors indicates that colours have to be defined with e.g. \definecolor before use. Further, the color key belongs to TikZ, and the manual for TikZ/pgf section 15.2 Specifying a color says of /tikz/color=<color name> that
The <color name> is the name of a previously defined color.
What you could do is have your code write a series of \definecolor statements into each file, with colors named e.g. clr1, clr2 etc., and use \addplot [clr1]... etc.
Another possibility could be to define a new colormap, RGB colors can be used for that, and make a new cycle list based on that colormap. I'm not sure if this is any better though, I'm just throwing it out.
Both tikzpictures in the code below generate the same output:

\documentclass[11pt]{article}
\usepackage{pgfplots}
\begin{document}
% Define colours inside tikzpicture environment:
\begin{tikzpicture}
\definecolor{clr1}{RGB}{81,82,83}
\definecolor{clr2}{RGB}{31,182,83}
\definecolor{clr3}{RGB}{31,18,213}
\begin{axis}[
height=4cm,ymin=-1,ymax=3
]
\addplot [clr1, line width=5mm] coordinates {
(2, 0.0)
(4, 0.0)
};
\addplot [clr2, line width=5mm] coordinates {
(2, 1.0)
(4, 1.0)
};
\addplot [clr3, line width=5mm] coordinates {
(2, 2.0)
(4, 2.0)
};
\end{axis}
\end{tikzpicture}
% Define a new colormap and make a cycle list based on that
\begin{tikzpicture}
\begin{axis}[
colormap={foo}{
% make a list of N colors
rgb255(1)=(81,82,83);
rgb255(2)=(31,182,83);
rgb255(3)=(31,18,213);
},
% use 0,...,N-1
cycle list={[indices of colormap={0,...,2} of foo]},
% the following two lines just for example
height=4cm,ymin=-1,ymax=3,
every axis plot/.append style={line width=5mm}
]
\addplot coordinates {
(2, 0.0)
(4, 0.0)
};
\addplot coordinates {
(2, 1.0)
(4, 1.0)
};
\addplot coordinates {
(2, 2.0)
(4, 2.0)
};
\end{axis}
\end{tikzpicture}
\end{document}
Does that help?
– Jim Newton Jan 10 '18 at 16:08\definecolor{col1}{RGB}{81,82,83}to the start of thetikzpictureand then use\addplot[color=col1] ..? Other than that, would writing options to theaxisbe a possibility? I think (but I'm not sure) that colours have to be named colours, but you could generate a colourmap with RGB colours, and make acycle listbased on the colourmap. – Torbjørn T. Jan 10 '18 at 16:51Does it hurt anything if I end up defining the same color many times and they all get included in the latex file? Or do I need to try to only define each color once?
– Jim Newton Jan 10 '18 at 17:10tikzpictureenvironment it won't be available outside it, but I don't think it hurts to have multiple definitions. – Torbjørn T. Jan 10 '18 at 17:51