Magic blankets and carpets are the stuff of legend, but a fabric recently developed by scientists at the University of Maryland (UMD) has been proven to have the seemingly wondrous ability to regulate its wearer's body temperature.

Composed of "polymer fibres coated with carbon nanotubes" the material, which – conceivably – could have wide-ranging applications for residential design and the apparel industry, responds to localised environmental stimuli.

The fabric then expands and contracts, gradually heating up or cooling its wearer to offset temperature extremes.

The UMD researchers' paper – "Dynamic gating of infrared radiation in a textile" – was published in Science, a peer-reviewed journal.

According to the scientists, the adaptive effects of the textile open the "pathway for developing wearable localised thermal management systems that are autonomous and self-powered, as well as expanding our ability to adapt to demanding environments".

The invention comes after the Global Wellness Institute last month predicted that 2019 would be characterised by a rise in a "dizzying array of new technologies" in fashion, including "clothes that adapt to all kinds of environmental and bodily changes".

In a statement, Dr Min Ouyang, co-author of the paper, explained: "For all of history, the only way to regulate the radiator has been to take clothes off or put clothes on. But this fabric is a true bidirectional regulator."