Skip to content

Instantly share code, notes, and snippets.

@alexalannunes
Created April 28, 2025 18:17
Show Gist options
  • Save alexalannunes/5f1087206dabb0caffe2b7b56749c553 to your computer and use it in GitHub Desktop.
Save alexalannunes/5f1087206dabb0caffe2b7b56749c553 to your computer and use it in GitHub Desktop.
generate light colors for background color values ​​in comparative numbers
export function generateLightColor(): string {
// Generate random RGB values for light colors
const red = Math.floor(150 + Math.random() * 105); // Range: 150-255
const green = Math.floor(150 + Math.random() * 105); // Range: 150-255
const blue = Math.floor(150 + Math.random() * 105); // Range: 150-255
// Convert RGB to hex
return `#${((1 << 24) + (red << 16) + (green << 8) + blue).toString(16).slice(1)}`;
}
@alexalannunes
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment