This works:
\def\dodotablexrule[#1][#2]{\noalign{\color[#2]{\hrule height#1 depth\z@}}}

But doing inside halign (tables) things like:
\def\tablexrule{\dodoubleargument\dotablexrule}
\def\dotablexrule[#1][#2]{%
\doifemptyelse{#2}%
{\dodotablexrule[#1][\@@tbxframecolor]}%
{\dodotablexrule[#1][#2]}%
}
\def\dodotablexrule[#1][#2]{\noalign{\color[#2]{\hrule height#1 depth\z@}}}

I get the error:
! Misplaced \noalign.
\dodotablexrule [#1][#2]->\noalign
                                   {\color [#2]{\hrule height#1 depth\z@ }}

I get the impression that none if these argument related stuff works inside the halign template.
Is there a remedy? Or do I just have to give up hope using a unified macro and will have to resort  to separate macro's for default/chosen parameters?

Hans van der Meer