The first Hat Sisters costume John Michael Gray created was simple, compared with what followed.
For Provincetown's Carnival in 1984, he decorated two baseball caps with feathers and painted the bills orange. To the backs he attached flowing white material that connected to cuffs he and his future husband, Tim O'Connor, wore on their wrists — a visual rendition of Prince's song "When Doves Cry."
And though over their years they also became known for dresses they wore as the Hat Sisters, that first time they augmented their headwear with naught but flip-flops and white Speedos. "We were much younger and much, much, much thinner," O'Connor recalled with the laugh that has echoed through decades of their ever-changing designs.
This summer, not long after retiring full time to Provincetown, Dr. Gray was diagnosed with lung cancer that metastasized. He was 66 when he died at home Sept. 24.
Dividing 32 years between Provincetown and their former longtime home in the South End, the Hat Sisters became celebrated figures at parades, carnivals, and decades of charity gatherings, at which the allure of their presence helped raise hundreds of thousands of dollars for causes ranging from AIDS health care to cancer research.
"The Hat Sisters were always there for everybody, for any event of any kind. They would always be there with huge smiles and lots of love," said Harry Collings, a prominent LGBT community activist.
"To the community they were very special," he added. "People just knew them from all the country — they were icons from Boston. You never knew what they were going to wear. It was always something magical and whimsical and always be appropriate for the event."
By day, Dr. Gray was a longtime educator who was coordinator of fine arts for the Newton Public Schools from 1986 to 2008. He also served for decades as executive director of the New England Art Education Conference, was program co-director of the Globe's Scholastic Art & Writing Awards, and had been a board member of the Alliance for Young Artists & Writers.
"He stood out as someone who fought to keep art and music programs alive," said Charlotte Brumit, a former music teacher in Newton's schools. "He was so supportive of us and had this way of recognizing and honoring our unique talents. He always gave us the freedom to teach to our strengths and encouraged us to follow our creativities and our passions, and to really think outside the box."
When Dr. Gray arrived in Newton amid the burgeoning AIDS crisis, "so many public educators were still in the closet. All I can say about John Michael was that his closet had no doors," said Pauline Joseph, a retired art teacher in the Newton schools.
"He broke through a horrible wall and opened up an emotional space for so many people — not just for gay people to come out, but for straight people to come in and have a true relationship. In Newton, he led with incredible dignity and joy," she said.
Supervising arts for all of Newton's schools meant that Dr. Gray and his husband attended concerts and art exhibitions continually, often three or more times a week. "He just loved to see his teachers succeed and see the students succeed," O'Connor said. "Any level of success was fine with him. He was not a demanding human being, but what he expected was quality."
Born in Nashua, Dr. Gray grew up in Amherst, N.H., the middle of three siblings born to Vern Gray, who owned a business that made school furniture, and the former Phyllis Duff.
Dr. Gray was a boarding student at Lawrence Academy in Groton and graduated in 1971 with a bachelor's degree in fine arts from Cornell University. He received a master's in elementary education from Tufts University two years later, was a humanities fellow at Stanford University, and graduated from Boston University in 1983 with a doctorate in curriculum and administration.
His extensive education work before Newton included lecturing and teaching at Tufts and at Lesley and Emmanuel colleges, and serving as a senior consultant to the New Hampshire Department of Education. In 2011, the Massachusetts Art Education Association named him art educator of the year.
Dr. Gray met Timothy J. O'Connor at a dinner party, where O'Connor mistakenly thought he was already involved with someone who turned out to be an old prep school friend. They proceeded to run into each other a few more times, including at the Eagle, a popular gay bar in the South End.
"He comes over and says, 'What's going on, because I'd really like to know you, to have dinner,' " O'Connor said, and after resolving that Dr. Gray indeed wasn't attached, "I said, 'OK, let's talk,' and we've been talking since then — July 18, 1984."
They married on their 20th anniversary, in 2004, in a daylong series of gatherings. They began in linen slacks and Hawaiian shirts (with no hats) for the ceremony, changed to white pants and white sparkly hats for a buffet, and switched to bridal gowns and different hats to cut the wedding cake in the evening. Among the guests were their longtime friends the late Mayor Thomas M. Menino, who died of cancer in 2014, and his wife, Angela.
"John Michael Gray brought his unique spirit and joy to so many causes, events, and important milestones for our city," she said in an e-mail. "His ability to bring people together, disarming them with his kindness and generosity, really helped drive the changes we saw for our LGBT community around inclusion, acceptance, and civil rights. While the Hat Sisters may have brought a whimsical fancy to any affair, it was their heart and soul that really helped shape our city. Tommy and I had such fond memories and I am truly sorry to know cancer has taken another great leader from our city."
Not long after Dr. Gray and his husband became a couple, they launched the Hat Sisters, whose hundreds of creations included hats depicting Boston's City Hall and the Washington Monument. Dr. Gray was in Provincetown for Carnival, and O'Connor was still at work in Boston when he agreed by phone to make the trip down.
"I said, 'Well, there's a lot of costume parties, so we need to have costumes,' " Dr. Gray recalled in a video interview with Tony Zampella. "He said, 'I don't have time, I'm working.' I go, 'I guess I could do something for you. What would you want?' He said, 'I'll wear whatever you wear.' So I started to make two of everything, and that's how it started."
In addition to his husband, Dr. Gray leaves his sister, Martha Gray Eufemia of Wells, Maine.
Family and friends will gather to celebrate Dr. Gray's life at 1:30 p.m. Oct. 16 in Arlington Street Church, followed by a reception in Club Cafe in Boston.
A few hats have been auctioned for charity over the years, but most are "memories and photographs," O'Connor said. He and Dr. Gray often reused material from one set of hats in subsequent creations.
"It's the end of a journey for the Hat Sisters. There were always two, and never one," O'Connor said.
"He was a rare human being. He was a kind soul," he added. "He was the yin to my yang, and I was very fortunate to be the one to spend as many years with him as we had together."