String to tint.
Whether or not to use extended colours (16-98).
The passed string encased within IRC colour coding.
alias I = IRCControlCharacter; // Colour based on hash { immutable actual = "kameloso".ircColourByHash(Yes.extendedOutgoingColours); immutable expected = I.colour ~ "23kameloso" ~ I.colour; assert((actual == expected), actual); } { immutable actual = "kameloso^".ircColourByHash(Yes.extendedOutgoingColours); immutable expected = I.colour ~ "56kameloso^" ~ I.colour; assert((actual == expected), actual); } { immutable actual = "kameloso^11".ircColourByHash(Yes.extendedOutgoingColours); immutable expected = I.colour ~ "91kameloso^11" ~ I.colour; assert((actual == expected), actual); } { immutable actual = "flerrp".ircColourByHash(Yes.extendedOutgoingColours); immutable expected = I.colour ~ "90flerrp" ~ I.colour; assert((actual == expected), actual); }
Returns the passed string coloured with an IRC colour depending on the hash of the string, making for good "random" (uniformly distributed) nick colours in IRC messages.