Skip to content

Instantly share code, notes, and snippets.

View jmfrancois's full-sized avatar

Jean-Michel FRANCOIS jmfrancois

  • Talend by Qlik
  • France
  • 05:35 (UTC +02:00)
View GitHub Profile
function generateContrastingColors(baseColor, numberOfColors, minContrastRatio = 4.5) {
const colors = [];
let attempts = 0;
const maxAttempts = numberOfColors * 100;
while (colors.length < numberOfColors && attempts < maxAttempts) {
const newColor = getRandomColor();
const contrastRatio = getContrastRatio(baseColor, newColor);
if (contrastRatio >= minContrastRatio) {
colors.push(newColor);
#!/usr/bin/env node
/**
* # Preview what would be renamed (dry run)
* node rename-jsx-files.mjs packages/components --dry-run
*
* # Actually rename files
* node rename-jsx-files.mjs packages/components
*
* # Verbose mode to see all files processed
* node rename-jsx-files.mjs packages/components --verbose