mirror of
https://github.com/flarum/core.git
synced 2025-07-23 09:41:26 +02:00
convert: common/utils/stringToColor
This commit is contained in:
committed by
Franz Liedke
parent
3f25e74946
commit
c81a3c0a11
@@ -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 r;
|
||||||
let g;
|
let g;
|
||||||
let b;
|
let b;
|
||||||
@@ -51,11 +53,8 @@ function hsvToRgb(h, s, v) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the given string to a unique color.
|
* 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;
|
let num = 0;
|
||||||
|
|
||||||
// Convert the username into a number based on the ASCII value of each
|
// Convert the username into a number based on the ASCII value of each
|
Reference in New Issue
Block a user