Solution (source code)

= Solution

For one colour, the box occupancies form a <weak composition> of $k$ into $n$ nonnegative parts. For $n\geq1$, <stars and bars> gives $\binom{k+n-1}{n-1}$ choices. The three colours' occupancies can be selected independently, so the number is
$$
\boxed{\binom{k+n-1}{n-1}^{\!3}.}
$$
Boxes are labelled, while equal-colour balls contribute only occupancy counts; no extra factorial for permuting such balls is appropriate.