Random HEX color

    0

    0

    Giovanny Gongora

    Codiga's TypeScript Recipes

    Generates a random hexadecimal color code.

    const randomHexColorCode = () => {
      let n: string = (Math.random() * 0xfffff * 1000000).toString(16);
      return '#' + n.slice(0, 6);
    };
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.