From 717d50254d497c574e7f88d49302d2a358eba196 Mon Sep 17 00:00:00 2001 From: Igor Zinken <730069+igorski@users.noreply.github.com> Date: Sat, 31 Jan 2026 16:43:17 +0100 Subject: [PATCH] code cleanups --- src/utils/color-util.ts | 4 +--- tests/unit/utils/color-util.spec.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/utils/color-util.ts b/src/utils/color-util.ts index 5ab07ca..9d394be 100644 --- a/src/utils/color-util.ts +++ b/src/utils/color-util.ts @@ -59,9 +59,7 @@ export const hexToRGBA = ( hex: string ): RGBA => { ]; }; -export const RGBAtoHex = ( rgba: RGBA ): string => { - const [ r, g, b, a ] = rgba; - +export const RGBAtoHex = ( [ r, g, b, a ]: RGBA ): string => { const rgbHex = `#${intToHex(r)}${intToHex(g)}${intToHex(b)}`; return a === 255 ? rgbHex : `${rgbHex}${intToHex(a)}`; diff --git a/tests/unit/utils/color-util.spec.ts b/tests/unit/utils/color-util.spec.ts index 088e813..0dedb2a 100644 --- a/tests/unit/utils/color-util.spec.ts +++ b/tests/unit/utils/color-util.spec.ts @@ -3,7 +3,7 @@ import { hexToRGBA, RGBAtoHex } from "@/utils/color-util"; describe( "Color utilities", () => { describe( "when converting hex to RGBA", () => { - it( "should convert hex a hex value without transparency to be fully opaque", () => { + it( "should convert a hex value without transparency to a fully opaque RGBA value", () => { expect( hexToRGBA( "#FF0000" )).toEqual([ 255, 0, 0, 255 ]); });