An interactive web application built with HTML, SCSS/CSS, and Vanilla JavaScript that generates colorful circular elements at random positions on the screen whenever you click the button.
- Dynamic Color Generation: Generates random RGB colors on every click.
- Random Screen Placement: Spawns circular colored nodes dynamically at random percentages across the viewport.
- Interactive Button: Button background color dynamically syncs with the newly generated color, accompanied by a subtle click animation.
- Lightweight & Fast: Pure Vanilla JavaScript with zero external runtime dependencies.
- HTML5: Markup structure.
- SCSS / CSS3: Styling, layout centering, and button transition effects.
- JavaScript (ES6+): DOM manipulation and random RGB & coordinate math logic.
randomcolor/
├── index.html # Main HTML markup
├── style.scss # SCSS source stylesheet
├── style.css # Compiled CSS stylesheet
├── style.css.map # Source map for debugging
├── script.js # JavaScript logic for DOM creation & random colors
└── README.md # Project documentation
-
Clone or navigate to the repository:
cd frontend/javascript/randomcolor -
Open in browser:
- Double-click
index.htmlor open it with Live Server in VS Code / Antigravity IDE.
- Double-click
- Click on the Select Element button in the center of the screen.
- The JavaScript script generates:
- Random values for Red, Green, and Blue channels (
0-255). - Random coordinates for
$X$ and$Y$ viewport positions (0-100%).
- Random values for Red, Green, and Blue channels (
- A new
50pxcircular element is appended to the<main>container and positioned at the generated coordinates. - The button's background updates to reflect the new color.