This is a proposal. I first kicked out ifthen because it is not needed. Then I made the code seemingly more complicated by adding \smuggle. You could have a shorter code at the expense of making the intermediate list that defines the color global, but I didn't want to do that. But these are details.
The (updated) question is addressed by a macro \parsesplit which splits the list into two sublists. It works like
\parsesplit(<long list with (at least) 6 entries>)->(<first>,<second>)
where first and second are the names of the macros in which the sublists are to be stored. In the MWE below these are \mycolone and \mycoltwo, which can then be used to define colors via
\definecolor{mycol1}{rgb}{\mycolone}
\definecolor{mycol2}{rgb}{\mycoltwo}
And this is the MWE. In this updated MWE, I removed the smuggling, and added something that allows you to scale the picture with a simple scale=....
\documentclass{standalone}
\usepackage{tikz}
\def\parsesplit(#1,#2,#3,#4,#5,#6)->(#7,#8){%
\edef#7{#1,#2,#3}%
\edef#8{#4,#5,#6}%
}
\begin{document}
\begin{tikzpicture}
\tikzset{
trigram/.pic={
\edef\temp{\noexpand\parsesplit(#1)->(\noexpand\mycolone,\noexpand\mycoltwo)}
\temp
\pgfgettransformentries{\tmp}{\tmp}{\tmp}{\yscale}{\tmp}{\tmp}
\definecolor{mycol1}{rgb}{\mycolone}
\definecolor{mycol2}{rgb}{\mycoltwo}
\foreach \d [count=\n] in #1{
\ifnum\d=0
\ifnum\n<4
\draw [color=mycol1,yshift=\n*2cm, line width=\yscale*1cm] (-6,0) -- (-1,0) (1,0) -- (6,0);
\else
\draw [color=mycol2,yshift=\n*2cm, line width=\yscale*1cm] (-6,0) -- (-1,0) (1,0) -- (6,0);
\fi
\else
\ifnum\n<4
\draw [color=mycol1,yshift=\n*2cm, line width=\yscale*1cm] (-6,0) -- (6,0);
\else
\draw [color=mycol2,yshift=\n*2cm, line width=\yscale*1cm] (-6,0) -- (6,0);
\fi
\fi
}
},}
\foreach [count=\n] \m in {
{0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1},
{1, 0, 0, 1, 1, 1}}{
\pic[scale=0.5] at (\n*15,0) {trigram = \m};
}
\end{tikzpicture}
\end{document}

OLD STUFF(may be useful for some):I am not sure if that's the correct interpretation so here is another one.
\documentclass{standalone}
\usepackage{tikz}
%% smuggling from https://tex.stackexchange.com/a/470979/121799
\newcounter{smuggle}
\DeclareRobustCommand\smuggleone[1]{%
\stepcounter{smuggle}%
\expandafter\global\expandafter\let\csname smuggle@\arabic{smuggle}\endcsname#1%
\aftergroup\let\aftergroup#1\expandafter\aftergroup\csname smuggle@\arabic{smuggle}\endcsname
}
\DeclareRobustCommand\smuggle[2][1]{%
\smuggleone{#2}%
\ifnum#1>1
\aftergroup\smuggle\aftergroup[\expandafter\aftergroup\the\numexpr#1-1\aftergroup]\aftergroup#2%
\fi
}
\begin{document}
\begin{tikzpicture}
\tikzset{
hexagram/.pic={
\foreach \d [count=\n] in #1{
\ifnum\d=0
\draw [yshift=\n*2cm, line width=1cm] (-6,0) -- (-1,0) (1,0) -- (6,0);
\else
\draw [yshift=\n*2cm, line width=1cm] (-6,0) -- (6,0);
\fi
}},
trigram/.pic={
\foreach \d [count=\n] in #1{
\ifnum\n<4
\ifnum\n=1
\edef\collst{\d}
\else
\edef\collst{\collst,\d}
\fi
\else
\pgfmathsetmacro{\mycol}{{\collst}[\n-4]}
\ifnum\d=0
\draw [color=\mycol,yshift=\n*2cm, line width=1cm] (-6,0) -- (-1,0) (1,0) -- (6,0);
\else
\draw [color=\mycol,yshift=\n*2cm, line width=1cm] (-6,0) -- (6,0);
\fi
\fi
\smuggle{\collst}
}},
}
\foreach [count=\n] \m in {
{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1},
{0, 0, 0, 1, 1, 1}}{
\pic at (\n*15,0) {hexagram = \m};
}
\begin{scope}[yshift=-15cm]
\foreach [count=\n] \m in {
{"blue","red","blue", 0, 0, 0},
{"black","red","red", 0, 0, 1},
{"blue","black","orange", 1, 1, 1}}{
\pic at (\n*15,0) {trigram = \m};
}
\end{scope}
\end{tikzpicture}
\end{document}
