If heat trasmites mainly though radiation, why is colder out of the atmosphere, when we are nearer the sun?
Heat tranmission is different than heat retention. The atmosphere retains the heat to the level that life can exist. It is the so called "green house effect".
The moon which has no atmosphere gets fried in the sun and near zero in the shadow.
Why is the temperature in the green house hotter than outside the green house?
answer:there is no direct convection to remove heat from the greenhouse, the bulk can just cool by radiation, and inner convection which will transfer heat by conduction to the outside glass for outside convection. This raises the temperature in the greenhouse with respect to the outside conditions. Same with a closed car where children die when left there in the sun.
Then, if heat trasmites mainly through radiation
within the atmosphere convection plays a huge role in heat transmission.
-as in a fire-,
Within the atmosphere of the room convection plays a large role in homogenizing temperature. Radiation has to be absorbed by something, transfer kinetic energy to the molecules , to be counted in the average kinetic energy as temperature.
but why there is such a difference out of atmosphere if heat comes from radiation?
Change in heat is connected with a change in temperature, and temperature is defined by the kinetic energy of the molecules.
So objects get hotter when the kinetic energy of the molecules that composes them gets larger. Out of the atmosphere there are very few molecules to absorb the radiation and increase their kinetic energy .Heat is energy and in the vacuum of space there are very few molecules to carry any energy.