Skip to content

Beginner-friendly project to understand DOM manipulation and random color generation in JavaScript.

Notifications You must be signed in to change notification settings

Mohammed-Sam08/Random-Color_Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Random Color Generator (JavaScript)

A beginner-friendly JavaScript mini project that dynamically changes the background and text color of elements using random RGB values.

๐Ÿš€ Features

  • Generates random colors using JavaScript
  • Applies colors to multiple elements
  • Uses DOM manipulation
  • Simple and clean logic

๐Ÿ› ๏ธ Technologies Used

  • HTML
  • CSS
  • JavaScript

๐Ÿ“ธ How It Works

  • Selects all child elements inside a container
  • Generates random RGB values
  • Applies them as background and text color

๐Ÿง  Learning Outcomes

  • Understanding of DOM selection
  • Working with arrays and loops
  • Random number generation
  • Dynamic styling using JavaScript

โ–ถ๏ธ How to Run

  1. Download or clone the repository
  2. Open index.html in your browser
  3. Refresh to see new random colors

๐Ÿ“Œ Example Code

function getRandomColor(){
    let val1 = Math.ceil(Math.random() * 255);
    let val2 = Math.ceil(Math.random() * 255);
    let val3 = Math.ceil(Math.random() * 255);
    return `rgb(${val1}, ${val2}, ${val3})`;
}

About

Beginner-friendly project to understand DOM manipulation and random color generation in JavaScript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published