University of Maryland

Anyone who lives in San Francisco knows it's all about wearing layers. Temperatures can vary dramatically from neighborhood to neighborhood -- one minute you're stripping off your sweater, the next you're wishing you brought your snow parka along and dreaming of life in Arizona.

If a new temperature-adapting fabric out of the University of Maryland makes it into our closets, life in such fickle climes could get simpler.

The fabric automatically changes according to the environment thanks to specially engineered yarn coated with carbon nanotubes.

The yarn expands and collapses based on the heat and humidity, which changes the spacing of the fibers. If the fabric's near warm and moist conditions, such as a sweating body, the fibers let heat pass through. In cooler and drier conditions, the fabric reduces the heat that escapes.

Video: Watch this smart fabric change color at the touch of an app

Plenty of fabrics already wick away moisture or work to keep you cool when it's blazing out, but what's notable here is the smart fabric's ability to adapt to the world around it.

"The human body is a perfect radiator. It gives off heat quickly," said Min Ouyang, a UMD physics professor and co-author of a new paper on the research in the journal Science. "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."

The scientists hope their work will lead to what they call "comfort-adjusting clothing," though they say more work is needed before stores sell shirts that react to San Francisco's maddening weather.

Still, the research does present some exciting possibilities for futuristic fashionistas. Pair this stuff with app-controlled color-changing smart clothes and we're really talking.

Taking It to Extremes: Mix insane situations with everyday tech, and here's what happens.

The Smartest Stuff: Innovators are finding new ways to make you, and the things around you, smarter.