Resistor, working & Color coding:
Resistor:

A resistor is a passive two terminal electrical component that implements electrical resistance as a circuit element.
In electronic circuits, resistors are used to reduce current flow, adjust signal levels, divide voltages, bias active elements, and terminate transmission lines, among other uses.

High power resistors that can dissipate many watts of electrical power as heat may be used as part of motor controls, power distribution systems, or test loads for generators.

Fixed resistors have resistances that only change slightly with temperature, time, or operating voltage. Variable resistors can be used to adjust circuit elements (such as volume control or a lamp dimmer), or as sensing devices for heat, light, humidity, force, or chemical activity.
The function of the resistor:

The hydraulic analogy compares electric current flowing through circuits to water flowing through pipes. When a pipe (left) is clogged with hair (right), it takes a larger pressure to achieve the same flow of water. Pushing electric current through a large resistance is like pushing water through a pipe clogged with hair: It requires a larger push (voltage) to drive the same flow (electric current).

The behavior of an ideal resistor is dictated by the relationship specified by Ohm's law: Ohm's law states that the voltage (V) across a resistor is proportional to the current (I), where the constant of proportionality is the resistance (R).
For example, 

If a 10-ohm resistor is attached across the terminals of a 50-volt battery, then a current of 50 / 10 = 5A amperes flows through that resistor.
Resister Color Coding & Table:

The electronic color code is used to indicate the values or ratings of electronic components, usually for resistors, but also for capacitors, inductors, diodes, and others. 
A separate code, the 25-pair color code, is used to identify wires in some telecommunications cables.
Resistor Color Coding:

Resistor Color bands were used because they were easily and cheaply printed on tiny components. First I show the color chart of the resistor and calculate the 4 color band resistor. band A is the first significant figure of component value (left side). band B is the second significant figure (some precision resistors have a third significant figure, and thus five bands). band C is the decimal multiplier. band D if present, indicates tolerance of value in percent (no band means 20%).
For example,
A resistor with bands of yellow, violet, red, and gold has first digit 4 (yellow in table below), second digit 7 (violet), and followed by 2 (red), 100: 4,700 ohms. Gold signifies that the tolerance is ±5%, so the real resistance could lie anywhere between 4,465 and 4,935 ohms.
Thank You