Skip to content

Commit

Permalink
Add comments to code
Browse files Browse the repository at this point in the history
  • Loading branch information
martfojt committed Jan 12, 2024
1 parent 830c435 commit f2e1604
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { argv } from 'node:process';
import chalk from 'chalk';
import randomColor from 'randomcolor';

// Function to generate block of # with hex value in the middle
function generateColor(color) {
const block = `
###############################
Expand All @@ -14,12 +15,15 @@ function generateColor(color) {
###############################
###############################
`;
// Use chalk to color the block with the generated hex color value
return chalk.hex(color)(block);
}

// Variables for generating hue and luminosity using argv
const hue = argv[2];
const luminosity = argv[3];

// Call randomColor function, with properties for hue and luminosity and then generate color based on then
const color = randomColor({ hue: hue, luminosity: luminosity });

// Call generateColor function and log const block with color hex value in the middle
console.log(generateColor(color));

0 comments on commit f2e1604

Please sign in to comment.