String to colour.
A copy of the program-global CoreSettings.
word, now in colour based on the hash of its contents.
import std.conv : to; CoreSettings brightSettings; CoreSettings darkSettings; brightSettings.brightTerminal = true; { immutable coloured = "kameloso".colourByHash(darkSettings); assert((coloured == "\033[38;5;227mkameloso\033[0m"), coloured); } { immutable coloured = "kameloso".colourByHash(brightSettings); assert((coloured == "\033[38;5;222mkameloso\033[0m"), coloured); } { immutable coloured = "zorael".colourByHash(darkSettings); assert((coloured == "\033[35mzorael\033[0m"), coloured); } { immutable coloured = "NO".colourByHash(brightSettings); assert((coloured == "\033[90mNO\033[0m"), coloured); }
Shorthand function to colour a passed word by the hash of it.