String to colour.
A variadic combination of one or more std.typecons.Flag flags to configure the output.
word, now in colour based on the hash of its contents.
import std.conv : to; { immutable coloured = "kameloso".colourByHash(No.brightTerminal, Yes.extendedColours); assert((coloured == "\033[38;5;227mkameloso\033[0m"), coloured); } { immutable coloured = "kameloso".colourByHash(Yes.extendedColours, Yes.brightTerminal); assert((coloured == "\033[38;5;222mkameloso\033[0m"), coloured); } { immutable coloured = "kameloso".colourByHash(Yes.brightTerminal); assert((coloured == "\033[38;5;222mkameloso\033[0m"), coloured); } { immutable coloured = "zorael".colourByHash(Yes.extendedColours); assert((coloured == "\033[35mzorael\033[0m"), coloured); } { immutable coloured = "zorael".colourByHash(No.extendedColours, Yes.extendedColours); assert((coloured == "\033[35mzorael\033[0m"), coloured); } { immutable coloured = "NO".colourByHash(Yes.extendedColours); assert((coloured == "\033[90mNO\033[0m"), coloured); }
Shorthand function to colour a passed word by the hash of it.