mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-01-30 18:39:50 +08:00
Update misc.ts
This commit is contained in:
parent
27965be7ff
commit
4781c6e8d4
1 changed files with 3 additions and 3 deletions
|
@ -271,17 +271,17 @@ function hexToRgb(hex: string):
|
|||
b: number;
|
||||
}
|
||||
| undefined {
|
||||
if (hex.length != 4 && hex.length != 7 && !hex.startsWith("#")) {
|
||||
if (hex.length !== 4 && hex.length !== 7 && !hex.startsWith("#")) {
|
||||
return undefined;
|
||||
}
|
||||
let r: number;
|
||||
let g: number;
|
||||
let b: number;
|
||||
if (hex.length == 4) {
|
||||
if (hex.length === 4) {
|
||||
r = ("0x" + hex[1] + hex[1]) as unknown as number;
|
||||
g = ("0x" + hex[2] + hex[2]) as unknown as number;
|
||||
b = ("0x" + hex[3] + hex[3]) as unknown as number;
|
||||
} else if (hex.length == 7) {
|
||||
} else if (hex.length === 7) {
|
||||
r = ("0x" + hex[1] + hex[2]) as unknown as number;
|
||||
g = ("0x" + hex[3] + hex[4]) as unknown as number;
|
||||
b = ("0x" + hex[5] + hex[6]) as unknown as number;
|
||||
|
|
Loading…
Reference in a new issue