Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

generate a hex colour, random hex code

const randomHexColor = () =>
  `#${Math.random().toString(16).slice(2, 8).padEnd(6, '0')}`;
console.log(randomHexColor()); // #7a10ba (varies)
console.log(randomHexColor()); // #65abdc (varies)
Source by livecodestream.dev #
 
PREVIOUS NEXT
Tagged: #generate #hex #random #hex #code
ADD COMMENT
Topic
Name
5+3 =