<?php if($_product->getTypeId() == "configurable"):
In if condition, we checked whether the product is configurable or not. If it is, then we have called getTypeInstance()->getUsedProductIds() method (In short way, this is called function to function calling). Using this method, we can get all the ids of simple products linked with configurable products.
$simpleproduct = Mage::getModel('catalog/product')->load($id); ?>
The above statement will load all simple products in foreach() loop to create all object of simple products using getModel() method.
By using $simpleproduct as object we called getQty() & getAttributeText('color') method to get total quantity left of simple products with different color which is associated with configurable product.