getColourCode static method

int getColourCode(
  1. String name
)

Returns the color code corresponding to the given name. If the name matches the translated version of "you", returns the color code for black (0Xff000000).

@param name The name for which the color code is to be determined. @return The color code as an integer value.

Implementation

static int getColourCode(String name) {
  if (name == getTranslated("you")) return 0Xff000000;
  var colorsArray = Constants.defaultColorList;
  var hashcode = name.hashCode;
  var rand = hashcode % colorsArray.length;
  return colorsArray[(rand).abs()];
}