收藏主机.
This commit is contained in:
@@ -50,6 +50,17 @@ export function md5(plain: string): string {
|
||||
return Md5.hashStr(plain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据颜色
|
||||
*/
|
||||
export function dataColor(str: string, colors: string[]): string {
|
||||
let total = 0;
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
total += str.charCodeAt(i);
|
||||
}
|
||||
return colors[total % colors.length];
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断值是否非空
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user