1
0
mirror of https://github.com/flarum/core.git synced 2025-07-22 17:21:27 +02:00

convert: common/utils/stringToColor

This commit is contained in:
David Sevilla Martin
2020-06-23 10:05:27 -04:00
committed by Franz Liedke
parent 3f25e74946
commit c81a3c0a11

View File

@@ -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