Rejecting the offer of some new pants, Stephen tells Mulligan, "I can't wear them if they are grey." He is rigidly upholding an outdated Victorian convention, no doubt because of the terrible guilt that he feels about his mother's death. And he is becoming Hamlet, in a symbolic costume display that will ally him with Bloom.
Gifford notes that “In the mid-Victorian world, the period of a son’s deep mourning for his mother (black suit, shoes, socks, and tie and a sharply limited social life) would have been a year and a day. By 1904 the rules had been considerably relaxed, but Stephen is adhering to the letter of the old law.” We learn in Ithaca that Stephen's mother was buried on 26 June 1903, so only a few more days remain before the old custom will allow Stephen to “go into ‘second mourning’ (gray would be acceptable).”
To this realistic explanation Joyce adds a symbolic parallel. Stephen’s insistence on dressing in formal mourning attire when others in his world recommend moving on with life likens him to Hamlet. The contrast, later in Telemachus, between his mourning clothes and the “gay attires” of Mulligan and Haines furthers this resemblance, since Hamlet first appears in a scene of high court ceremony where everyone else is dressed festively to celebrate marriage and dynastic stability, and his mother urges him to "cast thy nighted colour off." Mulligan's mocking rebuke—"Etiquette is etiquette. He kills his mother but he can't wear grey trousers"—further allies him with Gertrude and Claudius.
As Bloom walks down the sunny side of the street in Calypso he thinks, "Be a warm day I fancy. Specially in these black clothes feel it more. . . . But I couldn't go in that light suit. Make a picnic of it." His scrupulous adherence to the customs of mourning (he will be attending Paddy Dignam's funeral later in the morning) associates him with Stephen, and throughout the day the two men will be dressed alike. The implicit allusion to Hamlet invests the physical resemblance with a symbolic suggestion that both men are outsiders, skeptical and alienated. It also contributes to the idea that they may somehow play the roles of father and son.