Mood
A Sim's mood is determined by the level of needs they have and, in The Sims 3, their moodlets.
The bar next to the needs (or moodlets[TS3]) indicates mood. Green (which is usually indicated by the upper part of the bar) indicates good mood, and means that the average level of the needs are green or the Sims has more positive moodlets. The higher and greater the amount of the green, the better mood the Sim is in. If there is no color in the bar, that indicates the Sim is in a neutral mood; neither good nor bad. Red (which is indicated by the lower part of the bar) indicates bad mood, and means that the average level of the needs are red or yellow. The higher and greater the amount of the red, the worse mood the Sim is in.
Sims that are in a bad mood will only do things that will increase their need levels (such as sleeping when energy is low, eating when hunger is low, etc.) They will not do anything that will either have no effect or worsen their moods (such as study, exercising, etc). Sims in a good mood will be able to do anything.
In The Sims 3, if a Sim's mood is in the top section of the bar, they will automatically generate lifetime happiness points. Sims also learn skills faster when they are in a good mood.