BackgroundRecent research has suggested that an increase in temperature can negatively affect mental health and increase hospitalization for mental illness. It is not clear, however, what factors or mechanisms mediate this association. We aimed to (1) investigate the associations between ambient temperatures and bad daily mood, and (2) identify variables affecting the strength of these associations (modifiers) including the time, the day of the week and the year of the mood rating, socio-demographic characteristics, sleep quality, psychiatric disorders and the personality trait neuroticism in the community.MethodsData stemmed from the second follow-up evaluation of CoLaus|PsyCoLaus, a prospective cohort study conducted in the general population of Lausanne (Switzerland). The 906 participants rated their mood level four times a day during seven days using a cell phone app. Mixed-effects logistic regression was used to determine the association between daily maximum temperature and mood level. Participant ID was inserted as a random effect in the model, whereas the time of the day, the day of the week and the year were inserted as fixed effects. Models were controlled for several confounders (socio-demographic characteristics, sleep quality, weather parameters and air pollutants). Stratified analyses were conducted based on socio-demographic characteristics, sleep quality, presence of psychiatric disorders or a high neuroticism.ResultsOverall, the probability of having a bad mood for the entire day decreased by 7.0% (OR: 0.93: 95% CI 0.88, 0.99) for each 5 °C increase in maximum temperature. A smaller and less precise effect (-3%; OR: 0.97: 95% CI 0.91, 1.03) was found when controlling for sunshine duration. A higher association was found in participants with bipolar disorder (-23%; OR: 0.77: 95% CI 0.51, 1.17) and in participants with a high neuroticism (-13%; OR: 0.87 95% CI 0.80, 0.95), whereas the association was reversed for participants with anxiety (20%; OR: 1.20: 95% CI 0.90, 1.59), depression (18%; OR: 1.18 95% CI 0.94, 1.48) and schizophrenia (193%; OR: 2.93 95% CI 1.17, 7.73).ConclusionsAccording to our findings, rising temperatures may positively affect mood in the general population. However, individuals with certain psychiatric disorders, such as anxiety, depression, and schizophrenia, may exhibit altered responses to heat, which may explain their increased morbidity when exposed to high temperatures. This suggests that tailored public health policies are required to protect this vulnerable population.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12940-023-01003-9.