diff options
author | polwex <polwex@sortug.com> | 2025-05-21 15:28:03 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-05-21 15:28:03 +0700 |
commit | 9192e6c7747fd2d3f6a6c5c07d886a0982b53f11 (patch) | |
tree | c94a60a26732b697fa6734bff0fe898d690d2fd4 /src/lib/utils.ts | |
parent | e839a5f61f0faa21ca8b4bd5767f7575d5e576ee (diff) |
good tandem good tandem of ideas and implementation
Diffstat (limited to 'src/lib/utils.ts')
-rw-r--r-- | src/lib/utils.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/utils.ts b/src/lib/utils.ts index d3fdf9c..9bc74b8 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -49,3 +49,11 @@ export function handlePromise<T>( if (settlement.status === "fulfilled") return settlement.value; else return `${settlement.reason}`; } + +export function getRandomHexColor() { + // Generate a random number and convert it to a hexadecimal string + const randomColor = Math.floor(Math.random() * 16777215).toString(16); + + // Ensure the color code is always 6 digits by padding with zeros if needed + return "#" + randomColor.padStart(6, "0"); +} |