A simple, interactive web utility that generates a completely random background color on click and displays its corresponding hex code, automatically adjusting text contrast to maintain readability.
[Insert Live Demo Link Here]
- Random Generation: Generates millions of possible 6-character Hex color codes dynamically.
- Duplicate Prevention: Uses a
do...whileloop to guarantee no identical color is ever generated twice in a row. - Adaptive Contrast: Automatically calculates the mathematical brightness of the generated background color and adjusts the text to be either white or black.
- Frontend: HTML5, CSS3, Vanilla JavaScript (ES6+)
- Backend: N/A
- Database: N/A
- Other: N/A
git clone [https://github.com/ifeanyi234/Color-flipper.git](https://github.com/ifeanyi234/Color-flipper.git)
cd color-flipperBecause this is a Vanilla JavaScript project without build tools, simply open index.html directly in any modern web browser.
- The colors are mathematically random, meaning it does not generate curated or specifically "aesthetic" color palettes.
- The contrast algorithm uses a simplified RGB average formula (
$\frac{R+G+B}{3}$ ). While functional, it does not account for relative human eye sensitivity to different color wavelengths (e.g., pure green appears brighter to humans than pure blue).
- Clipboard Integration: Add a "Copy to Clipboard" button next to the hex code for easier usability.
- Format Toggle: Allow the user to switch the display format between Hex, RGB, and HSL modes.
- History Log: Add a sidebar that tracks the last 5 generated colors so users can return to a previous color they liked.


