In this article, we propose an efficient inexact gradient descent method to obtain the channel capacity-achieving input distribution of visible light communication (VLC). Under both a peak and an average optical power constraints, finding the channel capacity of VLC is formulated as a mixed continuous-discrete optimization problem without an analytical expression of the objective function. To solve this challenging problem, we first adopt the numerical integration method to approximate the objective function and its gradient. Here, we prove that the gaps between the original functions and the approximations can be arbitrarily small. Then, based on the approximated functions, we describe the method, and theoretically show that the obtained solution sequence converges to the channel capacity-achieving discrete distribution of VLC. We also provide simulation results to verify the effectiveness and optimality of the proposed method. More importantly, the simulations numerically reveal that on-off keying (OOK) modulation achieves the capacity of VLC channel at low signal-to-noise ratio (SNR), while pulse amplitude modulation (PAM) achieves the capacity at high SNR.