feat: Choose random color on collection creation (#3912)

Choose a random color from a shared color palette between backend
and frontend during collection creation.
This commit is contained in:
Apoorv Mishra
2022-08-04 14:18:19 +05:30
committed by GitHub
parent 4a16124a94
commit 0a6cfe5a6a
6 changed files with 29 additions and 16 deletions

View File

@@ -2,4 +2,8 @@ const randomInteger = (min: number, max: number) => {
return Math.floor(Math.random() * (max - min + 1) + min);
};
export { randomInteger };
const randomElement = <T>(arr: T[]): T => {
return arr[randomInteger(0, arr.length - 1)];
};
export { randomInteger, randomElement };

View File

@@ -28,3 +28,16 @@ export const sortNavigationNodes = (
: document.children,
}));
};
export const colorPalette = [
"#4E5C6E",
"#0366d6",
"#9E5CF7",
"#FF825C",
"#FF5C80",
"#FFBE0B",
"#42DED1",
"#00D084",
"#FF4DFA",
"#2F362F",
];