mirror of
https://github.com/kogakure/website-astro-stefanimhoff.de.git
synced 2026-02-04 04:25:28 +00:00
feat: add Journal index page
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
export * from './date';
|
||||
export * from './pick-two-random-colors';
|
||||
export * from './remark-reading-time';
|
||||
export * from './sort-by-date';
|
||||
export * from './sort-by-sortkey';
|
||||
|
||||
18
src/utils/pick-two-random-colors.ts
Normal file
18
src/utils/pick-two-random-colors.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import colorsJson from '../data/colors-japan.json';
|
||||
|
||||
interface Color {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
color: string;
|
||||
}
|
||||
|
||||
export const pickTwoRandomColors = (): [string, string] => {
|
||||
const colors: Color[] = colorsJson;
|
||||
const randomIndex1 = Math.floor(Math.random() * colors.length);
|
||||
let randomIndex2 = Math.floor(Math.random() * colors.length);
|
||||
while (randomIndex2 === randomIndex1) {
|
||||
randomIndex2 = Math.floor(Math.random() * colors.length);
|
||||
}
|
||||
return [colors[randomIndex1].color, colors[randomIndex2].color];
|
||||
};
|
||||
Reference in New Issue
Block a user