signal-desktop/ts/test-helpers/getRandomColor.ts

13 lines
355 B
TypeScript
Raw Normal View History

2021-08-05 20:17:05 -04:00
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2025-09-19 13:05:51 -07:00
import lodash from 'lodash';
import type { AvatarColorType } from '../types/Colors.js';
import { AvatarColors } from '../types/Colors.js';
2021-08-05 20:17:05 -04:00
2025-09-19 13:05:51 -07:00
const { sample } = lodash;
2021-08-05 20:17:05 -04:00
export function getRandomColor(): AvatarColorType {
return sample(AvatarColors) || AvatarColors[0];
}