We prove a generalisation of Bollobás' classical result on the asymptotics of the chromatic number of the binomial random graph to the stochastic block model. In addition, by allowing the number of blocks to grow, we determine the chromatic number in the Chung-Lu model. Our approach is based on the estimates for the weighted independence number, where weights are specifically designed to encapsulate inhomogeneities of the random graph.