Calculate resistance of resistor using colors