Kelvin thought the sun's heat came from gravitational compression and based his comments on that basis - WHICH WAS WRONG!
The gravitional compression theory came from Hermann von Helmholtz. Kelvin agreed. I think Kelvin's only objection to evolution was that there hadn't been enough time for it to happen, and for that he offered his computations for the age of the sun. The Age of the Sun.