From 4427c7fbedc191375e386b83c709571993017fb3 Mon Sep 17 00:00:00 2001 From: mac Date: Sat, 29 Jun 2024 21:32:40 +0300 Subject: [PATCH] Get random color palettes --- components/Colors.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/Colors.jsx b/components/Colors.jsx index 0e87c89..acf8f88 100644 --- a/components/Colors.jsx +++ b/components/Colors.jsx @@ -1,9 +1,16 @@ +import { useState, useEffect } from 'react' +import niceColors from 'nice-color-palettes' + import ntc from '@functions/ntc' import styles from '@styles/Colors.module.scss' import adjustTextColor from '@functions/adjustTextColor' export default () => { - const colors = ['#a1e8af', '#94c595', '#747c92', '#372772', '#3a2449'] + const [colors, setColors] = useState([]) + + useEffect(() => { + setColors(niceColors[Math.floor(Math.random() * niceColors.length)]) + }, []) return (