diff --git a/js/src/common/utils/stringToColor.js b/js/src/common/utils/stringToColor.ts similarity index 87% rename from js/src/common/utils/stringToColor.js rename to js/src/common/utils/stringToColor.ts index 2cb178898..4edd87cd7 100644 --- a/js/src/common/utils/stringToColor.js +++ b/js/src/common/utils/stringToColor.ts @@ -1,4 +1,6 @@ -function hsvToRgb(h, s, v) { +type RGB = { r: number; g: number; b: number }; + +function hsvToRgb(h: number, s: number, v: number): RGB { let r; let g; let b; @@ -51,11 +53,8 @@ function hsvToRgb(h, s, v) { /** * Convert the given string to a unique color. - * - * @param {String} string - * @return {String} */ -export default function stringToColor(string) { +export default function stringToColor(string: string): string { let num = 0; // Convert the username into a number based on the ASCII value of each