Following Sokomine's request, I have added support for showing the free space of the bags if you use the Unified Inventory mod. Here is a screenshot:
You can download the new version 0.2.0 from the first post.
If anyone of you knows more mods which add additional inventory-related stuff and you think these deserve support by this mod, please write here.
Also report any bugs and weirdnesses you encounter when using this mod.
Have fun!
Further notes: I have decided to not use a gradient into red. I guess the difference of color of “full” vs “almost full” would not be really distinguishable.
I also decided to keep the way the numbers are displayed as of now. Even if all slots are filled with only 1 dirt, you can't collect new items anymore (except dirt), so I want solely count occupied slots. And yes, 1 dirt on a slot makes the slot be counted as “occupied”.
Also, Krock, I don't see a viable alternative here. Remember that each item type may have a different maximum stack size, so this would not allow to display any exact numbers. And you also didn't say how to treat the empty slots with your method.
I stick with the raw inventory slots for now, because its simple and straight-forward. It is easy to implement and easy to understand.