The first time could have been chalked up to charming idiosyncrasy. The second seemed like an effort to bring some levity to a complicated situation. But the third and fourth (and fifth and so on) times that Prime Minister Justin Trudeau of Canada wore themed socks on a public occasion, it seemed clear that something more calculated was going on.

You’ve heard of fashion diplomacy, or frock diplomacy? The practice whereby a female politician, or the wife of a world leader, uses clothing to convey unspoken messages about a platform or position, or as a form of outreach?

Well, this is clearly sock diplomacy. It’s a new tactic in the political playbook.

And it reached an apogee of sorts on Sunday, when Mr. Trudeau marched in Toronto’s Gay Pride Parade wearing a rainbow-striped pair printed with the words “Eid Mubarak” in recognition of the Islamic festival that marks the end of Ramadan, and which coincided with this year’s parade. Yes, he honored two communities with one pair of socks. And he did so while also supporting local industry: They were made by a Toronto-based company, Halal Socks, and cost $14.99. All that doesn’t happen by accident.