If there's one thing you can count on finding in anybody's wardrobe, it's a pair of jeans - and the chances are those jeans will be blue.
The original work trousers, invented by Jacob Davis and Levi Strauss in 1873, were dyed with indigo derived from plants. By 1882, however, indigo was being synthesised, and producing denim blue now involves large quantities of petroleum, as well as toxic substances such as formaldehyde and cyanide.
Meanwhile, because indigo isn't water soluble, more toxic chemicals - corrosive to workers and deadly to marine life - need to be added to turn it into a liquid dye.
But San Francisco biotech firm Tinctorium believes it has the answer: genetically engineering bacteria to mirror the way the Japanese indigo plant, Polygonum Tinctorium, makes and holds its colour.
"Because bacteria are powerful multipliers, when you put them in the right conditions, we can grow these organisms to create dye product in a much more scalable and sustainable manner that isn't reliant on petroleum," says co-founder and chief executive Michelle Zhu.
The company is already producing yarn and is working to make jeans in the next two years in a process that Ms Zhu says will be competitive with existing methods in both cost and price.
And Tinctorium isn't the only company working to replace harsh chemicals with bioengineered organisms. France's Pili, for example, says that its microbial fermentation process can save 100 tonnes of petroleum and 10 tonnes of toxic chemicals per tonne of product.
"Instead of using petroleum as the raw material, the process uses renewable carbon such as agricultural waste that is transformed by micro-organisms instead of corrosive chemicals," says creative director Marie-Sarah Adenis.
"The process uses approximately five times less water and ten times less energy because microbes work at room temperature."
While Pili doesn't foresee commercial-scale production before 2021, UK-based Colorifix is already working with textile manufacturers such as Switzerland's Forster Rohner and India's Arvind, as well as fashion giant H&M.
The company was founded in 2016 by James Ajioka, Orr Yarkoni and David Nugent following a visit to Kathmandu as part of a project funded by the Wellcome Trust to develop a biosensor for detecting arsenic in drinking water.
"When we went and drove around the city, the rivers and the aqueducts were just toxic. The real problem in Kathmandu is that all of the textile industries are just dumping their waste straight into the river, and a lot of that was from textile dyeing," says Mr Ajoka.
As part of a previous project, Mr Ajioka had already bioengineered microbes to produce colour, and after further research, Colorifix was born.
While Tinctorium co-opts plant genes to make microbes make colour, Colorifix casts its net more widely.
"What we can do is take a parrot feather, scrape a few cells off the tail and then look in the DNA for the message 'make red'," explains Mr Yarkoni.
"Although all life uses DNA, each organism uses a different 'dialect', so we put that message in the dialect of the micro-organism and it can start making that pigment the same way the parrot does, starting from sugar and nitrogen," he says.
"We do it by fermentation - the same process you use to make alcohol. But instead of making alcohol, we make pigment."
One advantage of fermentation is that the base unit is sugar: easily available and requiring no major infrastructure to produce or refine. And, as Mr Ajioka points out, "We know that with fermentation, scaling up ends up being a fairly cheap activity - otherwise, beer wouldn't be as available as it is."
Another big plus for the process is that, unlike most dyeing technology, the process works across a wide range of materials.
"For instance, polyester and cotton need different types of dyes and generally different types of machines to dye them. Most apparel out there today is actually polycotton, and if you're not weaving it with pre-dyed thread, it needs to be cross-dyed, which means you're dyeing it twice," says Dr Orr.
"We can dye polycotton, so that already halves the amount of water being processed and the amount of chemicals and CO2 emissions."
Bacteria are even being used to produce hair dye - although the process is in its very earliest stages. University of Manchester students recently won a gold medal in the International Genetically Engineered Machine (iGEM) competition for genetically engineering E. coli bacteria to secrete proteins that can colour, repair and straighten hair.
Meanwhile, the University of Cambridge and Dutch biotechnology company Hoekmine are mutating bacteria to give them structural colour - colour created by the geometry of a surface, rather than pigment.
It's a trick used in nature by peacocks and blue morpho butterflies, among others.
The researchers change the dimensions of bacteria, or their ability to move, to change the wavelengths of light they reflect and thus their colour.
Silvia Vignolini from Cambridge's chemistry department says the technique could lead to pigments that can be easily produced in volume and that can change colour on demand.
"The future is open for biodegradable paints on our cars and walls," says Dr Vignolini, "simply by growing exactly the colour and appearance we want."