From 3cb4a9ce116d4810d14facf456f5a32dd5a19c5f Mon Sep 17 00:00:00 2001 From: Matt Kirby <MattJKirby@outlook.com> Date: Sat, 11 Mar 2023 21:40:52 +0000 Subject: [PATCH] Linear gradient utils function --- daily-thought-frontend/src/components/post/Utils.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 daily-thought-frontend/src/components/post/Utils.ts diff --git a/daily-thought-frontend/src/components/post/Utils.ts b/daily-thought-frontend/src/components/post/Utils.ts new file mode 100644 index 00000000..1ff7df19 --- /dev/null +++ b/daily-thought-frontend/src/components/post/Utils.ts @@ -0,0 +1,5 @@ +export function generateRandomLinearGradient(colors: string[], fixedAngle: boolean): string{ + const randomAngle = Math.random() * 360; + const gradient = Math.floor((Math.random() * 20) + 10); + return `linear-gradient(${fixedAngle? 117 : randomAngle}deg, ${colors[0]} ${gradient}%, ${colors[1]} ${100-gradient}%)` +} \ No newline at end of file -- GitLab