The Earth's sky is blue because the air molecules (largely nitrogen
and oxygen) are much smaller than the wavelength of light. When light
encounters particles much smaller than its wavelength, the scattered
intensity is inversely proportional to the 4'th power of the
wavelength. This is called "Rayleigh scattering," and it means that
half the wavelength is scattered with 2**4 = 16 times more intensity.
That's why the sky appears blue: the blue light is scattered some 16
times more strongly than the red light. Rayleigh scattering is also
the reason why the setting Sun appears red: the blue light has been
scattered away from the direct sunlight.
Thus, if the atmosphere of another planet is composed of a transparent
gas or gases whose molecules are much smaller than the wavelength of
light, we would, in general, also expect the sky on that planet to
have a blue color.
If you want another color of the sky, you need bigger particles in the
air. You need something bigger than molecules in the air---dust.
Dust particles can be many times larger than air molecules but still
small enough to not fall out to the ground. If the dust particles are
much larger than the wavelength of light, the scattered light will be
neutral in color (i.e., white or gray)---this also happens in clouds
here on Earth, which consist of water droplets. If the dust particles
are of approximately the same size as the wavelength of light, the
situation gets complex, and all sorts of interesting scattering
phenomena may happen. This happens here on Earth from time to time,
particularly in desert areas, where the sky may appear white, brown,
or some other color. Dust is also responsible for the pinkish sky on
Mars, as seen in the photographs returned from the Viking landers.
If the atmosphere contains lots of dust, the direct light from the Sun
or Moon may occasionally get some quite unusual color. Sometimes,
green and blue moons have been reported. These phenomena are quite
rare though---they happen only "once in a blue moon...." :) The dust
responsible for these unusual color phenomena is most often volcanic
in origin. When El Chicon erupted in 1982, this caused unusually
strongly colored sunsets in equatorial areas for more than one year.
The much bigger volcanic explosion at Krakatoa, some 110 years ago,
caused green and blue moons worldwide for a few years.
One possible exception to the above discussion is if the clouds on the
planet are composed of a strongly colored chemical. This might occur
on Jupiter, where the clouds are thought to contain sulfur, phosphorus,
and/or various organic chemicals.
It's also worth pointing out that the light of the planet's primary is
quite insignificant. Our eyes are highly adaptable to the dominating
illumination and perceive it as "white," within a quite wide range of
possible colors. During daytime, we perceive the light from the Sun
(6000 K) as white, and at night we perceive the light from our
incandescent lamps (2800 K, like a late, cool M star) as white. Only
if we put these two lights side-by-side, at comparable intensities,
will we perceive a clear color difference.
If the Sun was a hot star (say of spectral type B), it's likely we
still would perceive its light as "white" and the sky's color as blue