Yang-Mills theory as the foundation for quantum chromodynamics is a non-Abelian gauge theory with self-interactions between vector particles. Here, we study the Yang-Mills Hamiltonian with nonlinear color oscillations in the absence of external sources corresponding to the group $SU(2)$. In the quantum domain, we diagonalize the Hamiltonian using the optimized trigonometric basis expansion method and find accurate energy eigenvalues and eigenfunctions for one and two degrees of freedom. We also compare our results with the semiclassical solutions.