mirror of
https://github.com/flarum/framework.git
synced 2025-02-01 06:29:45 +08:00
convert: common/utils/stringToColor
This commit is contained in:
parent
20baa93ca7
commit
455327cca1
|
@ -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
|
Loading…
Reference in New Issue
Block a user