Bookmark this: tool.io/random/hex-color/source-code
Random Hex Color Generator Source Code
Browse the implementation files for Random Hex Color Generator.tool.ts typescript
import { calculateRandomHexColor } from '@tool.io/tools/random/hex-color';
import type { RandomSource } from '@tool.io/tools/random/number';
export { calculateRandomHexColor };
export const randomHexColor = (
random: RandomSource = Math.random
): string => {
const value = calculateRandomHexColor(random);
return value?.hex ?? '';
};
export const Tool: TypeTool = {
name: 'Random Hex Color Generator',
slug: 'random/hex-color',
intro: 'Generate a random six-digit hexadecimal CSS color.',
tool: randomHexColor,
i: [],
o: [
{
example: '#7F2A9C',
label: 'Random hex color',
placeholder: 'Random hex color',
render: 'textarea',
type: 'text'
}
],
rerunnable: true,
alternative: [
{
title: 'Random Hexadecimal Value',
url: '/random/hexadecimal'
},
{ title: 'Random Number', url: '/random/number' }
],
cite: [
{
title: 'Web colors - Wikipedia',
url: 'https://en.wikipedia.org/wiki/Web_colors'
}
]
};
export default Tool;
Description
Browse the implementation files for Random Hex Color Generator.