Obviously cost is the major concern, but often the importance of having color graphics in a printed book is overrated. For example, I have published a few print technical books with lots of screenshots, none of which would be better if the graphics were in color.
For example, a book specifically about css or layout or typography might not need color at all.
Yes, you're right that Packt and Oreilly typically use BW/grayscale graphics in their printed books, but I've also seen print examples from both publishers that are colorful. (Indeed, a lot of printed books about design are pretty awesome to look at).
When you're printing, you're trying to maximize royalties while keeping retail price low. When plugging in numbers via an online calculator for b/w and color versions of the same book, the cost differences can be substantial. One calculator shows it as costing 2x as much.
By the way, you have just described an easily overlooked advantage of ebooks -- the ability to include color graphics at no extra charge. I recently published a literary graphics with multiple interior graphics. I'm selling it at the minimum price (2.99) but if I sold it as print book, I'd have to increase the price so much that it wouldn't sell well.
(If you're buying a large number of print copies and selling it at workshops and conferences, the numbers improve somewhat though).