Function ansi_colours::ansi256_from_grey
source · Expand description
Returns index of a colour in 256-colour ANSI palette approximating given shade of grey.
A shade of grey is an sRGB colour whose red, green and blue components are
the same. The function takes that component value as an argument. It gives
the same results as ansi256_from_rgb((c, c, c))
but is faster.
Examples
assert_eq!( 16, ansi_colours::ansi256_from_grey(0));
assert_eq!( 16, ansi_colours::ansi256_from_grey(1));
assert_eq!(231, ansi_colours::ansi256_from_grey(255));