The answer you mention in comments indeed has
but it's a completely different situation. The definition of
which means that the argument to
\opening is saved in
\@opening for later usage. The redefinition instead saves the argument along with the desired color setting.
The definition of
\rule is completely different:
% latex.ltx, line 4984:
\newcommand. The purpose of the definition is to check whether
[ follows and to pass control to the internal command
\@rule. There's a fundamental difference between the two cases:
\@opening is just a container,
\@rule is a macro with arguments which is in charge of producing the rule.
You are instead trying to redefine
\@rule and this is unfortunately wrong.
What you should do is to define a new command, because
\rule might get used in other situations (perhaps internally, without you knowing). Do
\colorrule where you need a colored rule.