UNPKG

@slck/utils

Version:

utils library - Utility functions for common development.

19 lines 663 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateRandomColorFn = void 0; /** * Generates a random hex color code (excluding white and black). * @returns A random hex color code as a string. */ const generateRandomColorFn = () => { let color; do { // Generate a random hex color code color = `#${Math.floor(Math.random() * 0xffffff) .toString(16) .padStart(6, '0')}`; } while (color === '#000000' || color === '#FFFFFF'); // Exclude black and white return color; }; exports.generateRandomColorFn = generateRandomColorFn; //# sourceMappingURL=random-color.js.map