mirror of
https://github.com/sergeyyarkov/educt-server.git
synced 2026-10-11 10:19:20 +03:00
11 lines
347 B
TypeScript
11 lines
347 B
TypeScript
import Color from 'App/Models/Color';
|
|
import * as utils from 'App/Utils';
|
|
|
|
export default class ColorHelper {
|
|
public static async generateRandomColor(): Promise<Color | null> {
|
|
const colors = await Color.query();
|
|
if (colors.length === 0) return null;
|
|
return colors[utils.generateRandomInt({ min: 0, max: colors.length - 1 })];
|
|
}
|
|
}
|