Skip to content

Commit

Permalink
update isRGBColor (#1991)
Browse files Browse the repository at this point in the history
  • Loading branch information
igorDykhta committed Sep 30, 2022
1 parent 2845432 commit 13bcaa0
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/utils/src/color-utils.ts
Expand Up @@ -112,14 +112,11 @@ export function createLinearGradient(direction: string, colors: RGBColor[]) {
* Whether color is rgb
* @returns
*/
export function isRgbColor(color: unknown): color is RGBColor {
if (
export function isRgbColor(color: unknown): boolean {
return Boolean(
color &&
Array.isArray(color) &&
color.length === 3 &&
color.every(n => Number.isFinite(n) && n <= 255 && n >= 0)
) {
return true;
}
return false;
Array.isArray(color) &&
color.length === 3 &&
color.every(n => Number.isFinite(n) && n <= 255 && n >= 0)
);
}

0 comments on commit 13bcaa0

Please sign in to comment.