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

10 lines
331 B
TypeScript

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { sample } from 'lodash';
import type { AvatarColorType } from '../types/Colors.js';
import { AvatarColors } from '../types/Colors.js';
export function getRandomColor(): AvatarColorType {
return sample(AvatarColors) || AvatarColors[0];
}