Files
Desktop/ts/test-helpers/getRandomColor.std.ts
2026-03-30 12:42:37 -07:00

14 lines
427 B
TypeScript

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import lodash from 'lodash';
import type { AvatarColorType } from '../types/Colors.std.ts';
import { AvatarColors } from '../types/Colors.std.ts';
const { sample } = lodash;
export function getRandomColor(): AvatarColorType {
// oxlint-disable-next-line typescript/no-non-null-assertion
return sample(AvatarColors) || AvatarColors[0]!;
}