<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Varinder Pal Singh</title>
    <description>The latest articles on DEV Community by Varinder Pal Singh (@varinder_palsingh_7e97d6).</description>
    <link>https://dev.to/varinder_palsingh_7e97d6</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3169980%2Fc884d8c3-8454-4b6b-84fa-791fab03d83c.jpg</url>
      <title>DEV Community: Varinder Pal Singh</title>
      <link>https://dev.to/varinder_palsingh_7e97d6</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/varinder_palsingh_7e97d6"/>
    <language>en</language>
    <item>
      <title>How to Remove Metadata from Photos Before Sharing Them Online</title>
      <dc:creator>Varinder Pal Singh</dc:creator>
      <pubDate>Mon, 05 Oct 2026 09:41:58 +0000</pubDate>
      <link>https://dev.to/varinder_palsingh_7e97d6/how-to-remove-metadata-from-photos-before-sharing-them-online-4mbj</link>
      <guid>https://dev.to/varinder_palsingh_7e97d6/how-to-remove-metadata-from-photos-before-sharing-them-online-4mbj</guid>
      <description>&lt;p&gt;Learn how to remove EXIF data, GPS location, camera details, AI generator tags, and C2PA Content Credentials from photos before publishing or sharing them online.&lt;/p&gt;

&lt;p&gt;When you share a photo online, you're not always sharing only the visible image.&lt;/p&gt;

&lt;p&gt;Depending on the camera, phone, or software used to create the image, the file can contain additional metadata such as EXIF information, GPS coordinates, camera details, editing software information, AI generator tags, and other embedded data.&lt;/p&gt;

&lt;p&gt;If you don't need that information, removing it before publishing or sharing the photo can be a useful privacy step.&lt;/p&gt;

&lt;h2&gt;
  
  
  What information can a photo contain?
&lt;/h2&gt;

&lt;p&gt;Image metadata can include information such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;EXIF data&lt;/li&gt;
&lt;li&gt;GPS/location information&lt;/li&gt;
&lt;li&gt;Camera make and model&lt;/li&gt;
&lt;li&gt;Date and time&lt;/li&gt;
&lt;li&gt;Camera settings&lt;/li&gt;
&lt;li&gt;Software or editing application information&lt;/li&gt;
&lt;li&gt;AI generator metadata&lt;/li&gt;
&lt;li&gt;C2PA Content Credentials&lt;/li&gt;
&lt;li&gt;Other embedded metadata&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Not every image contains all of these fields. The information depends on how the image was created and processed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why remove metadata from photos?
&lt;/h2&gt;

&lt;p&gt;Metadata can sometimes reveal information that you didn't intend to publish.&lt;/p&gt;

&lt;p&gt;For example, GPS metadata can potentially reveal where a photo was taken. Camera and software information can also remain embedded in an image even though it isn't visible when you open the file normally.&lt;/p&gt;

&lt;p&gt;This can matter when publishing personal photos on websites, social media, forums, blogs, or other public platforms.&lt;/p&gt;

&lt;p&gt;Removing unnecessary metadata gives you more control over what information is included in the image file you share.&lt;/p&gt;

&lt;h2&gt;
  
  
  A simple way to remove photo metadata
&lt;/h2&gt;

&lt;p&gt;You can manually inspect and remove metadata using desktop software, but there is also a simpler option for people who just want to clean their images quickly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Strip AI Metadata
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.stripaimetadata.com/" rel="noopener noreferrer"&gt;Strip AI Metadata&lt;/a&gt; is a browser-based tool for removing metadata from photos.&lt;/p&gt;

&lt;p&gt;It can remove:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;EXIF metadata&lt;/li&gt;
&lt;li&gt;GPS location data&lt;/li&gt;
&lt;li&gt;Camera details&lt;/li&gt;
&lt;li&gt;AI generator tags&lt;/li&gt;
&lt;li&gt;C2PA Content Credentials&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can process as many photos as you like for free.&lt;/p&gt;

&lt;p&gt;The tool runs directly in your browser, so your photos never leave your device.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to remove metadata
&lt;/h2&gt;

&lt;p&gt;The process is simple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;a href="https://www.stripaimetadata.com/" rel="noopener noreferrer"&gt;Strip AI Metadata&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Select or upload your photos.&lt;/li&gt;
&lt;li&gt;Let the browser process the files.&lt;/li&gt;
&lt;li&gt;Download the cleaned images.&lt;/li&gt;
&lt;li&gt;Share or publish the cleaned versions.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Because the processing happens in the browser, you don't need to upload your personal photos to a remote server just to remove their metadata.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is EXIF metadata?
&lt;/h2&gt;

&lt;p&gt;EXIF stands for Exchangeable Image File Format.&lt;/p&gt;

&lt;p&gt;It is a metadata standard commonly used by digital cameras and smartphones.&lt;/p&gt;

&lt;p&gt;Depending on the device, an image can contain information such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Camera manufacturer&lt;/li&gt;
&lt;li&gt;Camera model&lt;/li&gt;
&lt;li&gt;Date and time&lt;/li&gt;
&lt;li&gt;Lens information&lt;/li&gt;
&lt;li&gt;Exposure settings&lt;/li&gt;
&lt;li&gt;Orientation&lt;/li&gt;
&lt;li&gt;GPS coordinates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most of this information isn't visible when you simply look at the photo.&lt;/p&gt;

&lt;h2&gt;
  
  
  What about GPS location data?
&lt;/h2&gt;

&lt;p&gt;GPS metadata can be particularly important from a privacy perspective.&lt;/p&gt;

&lt;p&gt;If location information is embedded in a photograph, someone who has access to the original file may be able to extract that information.&lt;/p&gt;

&lt;p&gt;For personal photographs, especially those taken at your home or other private locations, removing unnecessary location metadata before publicly sharing the file can be worthwhile.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are AI generator tags?
&lt;/h2&gt;

&lt;p&gt;Images created or processed by AI tools can contain metadata indicating information about the software or process used to generate or edit the image.&lt;/p&gt;

&lt;p&gt;If you don't want those tags included in a file you publish, metadata removal can help clean the image before sharing it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are C2PA Content Credentials?
&lt;/h2&gt;

&lt;p&gt;C2PA is a standard designed to provide information about the origin and history of digital content.&lt;/p&gt;

&lt;p&gt;Content Credentials can provide useful provenance information, but there may also be situations where you want to remove embedded credentials before distributing an image.&lt;/p&gt;

&lt;p&gt;If your goal is to create a metadata-clean version of an image, a metadata removal tool can be useful.&lt;/p&gt;

&lt;h2&gt;
  
  
  When should you remove image metadata?
&lt;/h2&gt;

&lt;p&gt;Consider removing unnecessary metadata when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Publishing personal photographs online&lt;/li&gt;
&lt;li&gt;Sharing photos publicly&lt;/li&gt;
&lt;li&gt;Uploading images to a website&lt;/li&gt;
&lt;li&gt;Sending images to people you don't know&lt;/li&gt;
&lt;li&gt;Publishing images on forums or communities&lt;/li&gt;
&lt;li&gt;Preparing images for a public project&lt;/li&gt;
&lt;li&gt;Sharing photographs taken with your phone&lt;/li&gt;
&lt;li&gt;Uploading AI-generated or AI-edited images&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You don't necessarily need to remove metadata from every image.&lt;/p&gt;

&lt;p&gt;Photographers, businesses, and creators may intentionally keep copyright, licensing, or provenance information in their files.&lt;/p&gt;

&lt;p&gt;The important thing is to understand what information your image contains and decide whether you want to share it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;Metadata is easy to overlook because most of it isn't visible when you open an image.&lt;/p&gt;

&lt;p&gt;Before publishing a personal photo, checking and removing unnecessary metadata can be a simple additional privacy measure.&lt;/p&gt;

&lt;p&gt;If you want a quick browser-based solution, &lt;a href="https://www.stripaimetadata.com/" rel="noopener noreferrer"&gt;Strip AI Metadata&lt;/a&gt; lets you remove EXIF, GPS location data, camera details, AI generator tags, and C2PA Content Credentials from photos for free.&lt;/p&gt;

&lt;p&gt;The processing happens in your browser, so your photos never leave your device.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>privacy</category>
      <category>security</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to Build a Hacker Typer Simulator with HTML, CSS, and JavaScript</title>
      <dc:creator>Varinder Pal Singh</dc:creator>
      <pubDate>Fri, 16 May 2025 11:30:56 +0000</pubDate>
      <link>https://dev.to/varinder_palsingh_7e97d6/how-to-build-a-hacker-typer-simulator-with-html-css-and-javascript-151i</link>
      <guid>https://dev.to/varinder_palsingh_7e97d6/how-to-build-a-hacker-typer-simulator-with-html-css-and-javascript-151i</guid>
      <description>&lt;p&gt;A Hacker Typer simulator is a fun web tool that makes you look like a pro hacker straight out of a Hollywood movie, with code streaming across the screen as you type. It’s perfect for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;😎 Pranking friends or coworkers with your “hacking skills.”
&lt;/li&gt;
&lt;li&gt;🎥 Creating a cinematic hacker vibe for streams or videos.
&lt;/li&gt;
&lt;li&gt;🧠 Adding a playful element to tech presentations or demos.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd3lpz1gl4wxhoptpxbx4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd3lpz1gl4wxhoptpxbx4.jpg" alt="hacker Typer" width="800" height="603"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this beginner-friendly tutorial, you’ll build your own Hacker Typer simulator inspired by &lt;a href="https://hackertyper.app" rel="noopener noreferrer"&gt;hackertyper.app&lt;/a&gt; using HTML, CSS, and JavaScript — no frameworks or external libraries required. By the end, you’ll have a tool that generates fake code as you type, complete with a terminal-like interface and fun “Access Granted” pop-ups.&lt;/p&gt;

&lt;p&gt;🛠️ Step 1: Create the HTML Structure&lt;br&gt;
Let’s start with a minimal HTML structure. We need:&lt;/p&gt;

&lt;p&gt;A textarea to display the streaming “code.”&lt;br&gt;
A div for pop-up messages like “Access Granted” or “Access Denied.”&lt;br&gt;
A settings area to toggle code style (hidden by default).&lt;/p&gt;

&lt;p&gt;Here’s the HTML (index.html):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;meta charset="UTF-8"&amp;gt;
  &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
  &amp;lt;meta name="description" content="Learn how to build a Hacker Typer simulator with HTML, CSS, and JavaScript to prank friends with fake hacking."&amp;gt;
  &amp;lt;meta name="keywords" content="hacker typer, web development, HTML, CSS, JavaScript, tutorial, prank"&amp;gt;
  &amp;lt;meta name="author" content="Your Name"&amp;gt;
  &amp;lt;title&amp;gt;Hacker Typer Simulator&amp;lt;/title&amp;gt;
  &amp;lt;link rel="stylesheet" href="styles.css"&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;div class="container"&amp;gt;
    &amp;lt;h1&amp;gt;Hacker Typer Simulator&amp;lt;/h1&amp;gt;
    &amp;lt;p&amp;gt;Inspired by &amp;lt;a href="https://hackertyper.app" target="_blank"&amp;gt;Hacker Typer&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;textarea id="codeOutput" readonly&amp;gt;&amp;lt;/textarea&amp;gt;
    &amp;lt;div id="popup" class="popup hidden"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;button id="settingsToggle"&amp;gt;Settings&amp;lt;/button&amp;gt;
    &amp;lt;div id="settings" class="settings hidden"&amp;gt;
      &amp;lt;label&amp;gt;Code Style: 
        &amp;lt;select id="codeStyle"&amp;gt;
          &amp;lt;option value="kernel"&amp;gt;Linux Kernel&amp;lt;/option&amp;gt;
          &amp;lt;option value="terminal"&amp;gt;Terminal&amp;lt;/option&amp;gt;
        &amp;lt;/select&amp;gt;
      &amp;lt;/label&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;script src="script.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What’s happening here?&lt;/p&gt;

&lt;p&gt;The  displays the fake code as you type.&lt;br&gt;
The #popup div shows “Access Granted” or “Access Denied” messages.&lt;br&gt;
The #settings div (toggled by a button) lets users switch between code styles (e.g., Linux kernel or terminal).&lt;br&gt;
Meta tags are included for SEO optimization.&lt;/p&gt;

&lt;p&gt;🛠️ Step 2: Style with CSS&lt;br&gt;
Next, let’s style the simulator to mimic a hacker’s terminal. We’ll use a dark theme, monospaced font, and animations for pop-ups.&lt;br&gt;
Here’s the CSS (styles.css):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;body {
  font-family: 'Courier New', monospace;
  margin: 0;
  padding: 20px;
  background-color: #1a1a1a;
  color: #00ff00;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

h1 {
  color: #00ff00;
}

textarea {
  width: 100%;
  height: 400px;
  background-color: #000;
  color: #00ff00;
  border: 2px solid #00ff00;
  padding: 10px;
  font-family: 'Courier New', monospace;
  font-size: 16px;
  resize: none;
  margin: 20px 0;
}

.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #000;
  color: #ff0000;
  padding: 20px;
  border: 2px solid #ff0000;
  font-size: 24px;
  text-align: center;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
  transition: opacity 0.5s;
}

.popup.hidden {
  opacity: 0;
  pointer-events: none;
}

.settings {
  background-color: #000;
  padding: 10px;
  border: 2px solid #00ff00;
  margin-top: 10px;
}

.settings.hidden {
  display: none;
}

button, select {
  padding: 8px 16px;
  background-color: #00ff00;
  color: #000;
  border: none;
  font-family: 'Courier New', monospace;
  cursor: pointer;
  margin: 5px;
}

button:hover, select:hover {
  background-color: #00cc00;
}

@media (max-width: 600px) {
  textarea {
    height: 300px;
  }

  .popup {
    font-size: 18px;
    padding: 15px;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key styles:&lt;/p&gt;

&lt;p&gt;The dark background and green text mimic a classic terminal.&lt;br&gt;
The  is styled to look like a coding environment with a monospaced font.&lt;br&gt;
The .popup uses a red border and animation for dramatic effect.&lt;br&gt;
The .settings section is hidden by default and toggled via a button.&lt;br&gt;
Responsive design adjusts the textarea height and popup size for mobile.&lt;/p&gt;

&lt;p&gt;🛠️ Step 3: Add JavaScript Functionality&lt;br&gt;
Now, let’s make the simulator interactive. We’ll:&lt;/p&gt;

&lt;p&gt;Generate fake code as the user types.&lt;br&gt;
Trigger “Access Granted” or “Access Denied” pop-ups after specific key combinations (e.g., Alt pressed three times).&lt;br&gt;
Allow users to switch between code styles (Linux kernel or terminal).&lt;br&gt;
Clear pop-ups with the Esc key.&lt;/p&gt;

&lt;p&gt;Here’s the JavaScript (script.js):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const codeOutput = document.getElementById('codeOutput');
const popup = document.getElementById('popup');
const settingsToggle = document.getElementById('settingsToggle');
const settings = document.getElementById('settings');
const codeStyle = document.getElementById('codeStyle');

const codeSnippets = {
  kernel: [
    'void init_kernel(void) {',
    '  printk(KERN_INFO "Initializing kernel module...");',
    '  setup_interrupts();',
    '  return 0;',
    '}',
    'struct task_struct *task = get_current();'
  ],
  terminal: [
    '$ sudo apt-get update',
    'Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease',
    '$ whoami',
    'user',
    '$ chmod +x script.sh',
    '$ ./script.sh'
  ]
};

let altCount = 0;
let currentStyle = 'kernel';

// Generate random code snippet
function addCodeSnippet() {
  const snippets = codeSnippets[currentStyle];
  const randomSnippet = snippets[Math.floor(Math.random() * snippets.length)];
  codeOutput.value += randomSnippet + '\n';
  codeOutput.scrollTop = codeOutput.scrollHeight;
}

// Show popup message
function showPopup(message, color) {
  popup.textContent = message;
  popup.style.color = color;
  popup.classList.remove('hidden');
  setTimeout(() =&amp;gt; {
    popup.classList.add('hidden');
  }, 2000);
}

// Handle typing
document.addEventListener('keydown', (e) =&amp;gt; {
  e.preventDefault(); // Prevent default textarea behavior
  if (e.key === 'Alt') {
    altCount++;
    if (altCount &amp;gt;= 3) {
      const isGranted = Math.random() &amp;gt; 0.5;
      showPopup(
        isGranted ? 'Access Granted' : 'Access Denied',
        isGranted ? '#00ff00' : '#ff0000'
      );
      altCount = 0;
    }
  } else if (e.key === 'Escape') {
    popup.classList.add('hidden');
  } else {
    addCodeSnippet();
  }
});

// Toggle settings
settingsToggle.addEventListener('click', () =&amp;gt; {
  settings.classList.toggle('hidden');
});

// Change code style
codeStyle.addEventListener('change', () =&amp;gt; {
  currentStyle = codeStyle.value;
  codeOutput.value = '';
});

// Focus textarea for immediate typing
codeOutput.focus();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How it works:&lt;/p&gt;

&lt;p&gt;The codeSnippets object stores fake code for two styles: Linux kernel and terminal commands.&lt;br&gt;
Typing any key (except Alt or Esc) adds a random snippet to the textarea and auto-scrolls to the bottom.&lt;br&gt;
Pressing Alt three times triggers a 50/50 chance of “Access Granted” (green) or “Access Denied” (red) pop-ups, which fade after 2 seconds.&lt;br&gt;
The Esc key hides pop-ups instantly.&lt;br&gt;
The settings menu lets users switch code styles, clearing the textarea for a fresh start.&lt;br&gt;
The textarea is read-only to prevent manual editing, and e.preventDefault() ensures typing doesn’t interfere with the simulation.&lt;/p&gt;

&lt;p&gt;🚀 Step 4: Test and Deploy&lt;/p&gt;

&lt;p&gt;Test locally: Save the three files (index.html, styles.css, script.js) in a folder and open index.html in  in a browser. Type any key to see code appear, press Alt three times for pop-ups, and test the settings toggle.&lt;br&gt;
Deploy: Host your tool on platforms like GitHub Pages, Netlify, or Vercel for free.&lt;br&gt;
Enhance: Want to level up? Add features like:&lt;br&gt;
Customizable colors and fonts in settings.&lt;br&gt;
Sound effects for typing or pop-ups.&lt;br&gt;
A “full-screen” mode toggle for max immersion.&lt;br&gt;
More code styles (e.g., Python, C++, or matrix-style code).&lt;/p&gt;

&lt;p&gt;🌟 Why Build Your Own?&lt;br&gt;
Building a Hacker Typer simulator is a fantastic way to practice event handling, DOM manipulation, and UI animations in JavaScript. It’s a lighthearted project that’s sure to impress friends or add flair to your tech content. For inspiration, check out Hacker Typer, a brilliant tool that’s been bringing hacker vibes to millions since 2011.&lt;br&gt;
Have questions or ideas to improve this prank tool? Drop a comment below, and let’s hack some fun together! 💻&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;SEO Optimization Details&lt;/p&gt;

&lt;p&gt;Keywords: The article targets keywords like “hacker typer simulator,” “HTML CSS JavaScript tutorial,” “build prank tool,” and “fake hacking game” to attract organic traffic.&lt;br&gt;
Meta Tags: The HTML includes meta tags for description, keywords, and author to improve search engine indexing.&lt;br&gt;
Backlink: A natural backlink to Hacker Typer is included twice (in the intro and conclusion) to drive traffic while maintaining relevance.&lt;br&gt;
Structure: Clear headings, concise steps, and code snippets make the article scannable and engaging, improving dwell time.&lt;br&gt;
Call to Action: The conclusion encourages comments to boost engagement on dev.to.&lt;br&gt;
Citations: Relevant web results are cited (e.g., for pop-up mechanics and site inspiration) to ensure credibility.&lt;/p&gt;

&lt;p&gt;Let me know if you’d like another individual article for a different tool or feature, or if you want adjustments to this one!&lt;/p&gt;

&lt;p&gt;Try the live demo here: &lt;a href="https://hackertyper.app" rel="noopener noreferrer"&gt;Hacker Typer&lt;/a&gt;&lt;br&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>html</category>
      <category>css</category>
    </item>
    <item>
      <title>How to Build a Would You Rather Game with HTML, CSS, and JavaScript</title>
      <dc:creator>Varinder Pal Singh</dc:creator>
      <pubDate>Fri, 16 May 2025 11:26:47 +0000</pubDate>
      <link>https://dev.to/varinder_palsingh_7e97d6/how-to-build-a-would-you-rather-game-with-html-css-and-javascript-51o1</link>
      <guid>https://dev.to/varinder_palsingh_7e97d6/how-to-build-a-would-you-rather-game-with-html-css-and-javascript-51o1</guid>
      <description>&lt;p&gt;A Would You Rather game is a fun, interactive web application that presents users with two quirky, thought-provoking, or hilarious choices, forcing them to pick one. It’s perfect for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🎉 Breaking the ice at parties or team-building events.
&lt;/li&gt;
&lt;li&gt;😄 Sparking debates with friends or online communities.
&lt;/li&gt;
&lt;li&gt;🧠 Engaging users with entertaining decision-making scenarios.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1kwv4yz7c9mftkmzuar.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1kwv4yz7c9mftkmzuar.jpg" alt=" Would You Rather Game" width="630" height="315"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this beginner-friendly tutorial, you’ll build your own "Would You Rather" game inspired by &lt;a href="https://wouldyourather.cc" rel="noopener noreferrer"&gt;wouldyourather.cc&lt;/a&gt; using HTML, CSS, and JavaScript — no frameworks or external libraries required. By the end, you’ll have a functional game where users can view random questions, select an option, and see a fun response.&lt;/p&gt;

&lt;p&gt;🛠️ Step 1: Create the HTML Structure&lt;br&gt;
Let’s start with a simple HTML structure. We need:&lt;/p&gt;

&lt;p&gt;A section to display the "Would You Rather" question.&lt;br&gt;
Two buttons for the user to choose between options.&lt;br&gt;
A button to generate a new question.&lt;br&gt;
A div to show the result of the user’s choice.&lt;/p&gt;

&lt;p&gt;Here’s the HTML (index.html):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;meta charset="UTF-8"&amp;gt;
  &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
  &amp;lt;meta name="description" content="Learn how to build a Would You Rather game with HTML, CSS, and JavaScript for fun decision-making scenarios."&amp;gt;
  &amp;lt;meta name="keywords" content="would you rather, web development, HTML, CSS, JavaScript, tutorial, game"&amp;gt;
  &amp;lt;meta name="author" content="Your Name"&amp;gt;
  &amp;lt;title&amp;gt;Would You Rather Game&amp;lt;/title&amp;gt;
  &amp;lt;link rel="stylesheet" href="styles.css"&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;div class="container"&amp;gt;
    &amp;lt;h1&amp;gt;Would You Rather Game&amp;lt;/h1&amp;gt;
    &amp;lt;div id="question" class="question"&amp;gt;Click "New Question" to start!&amp;lt;/div&amp;gt;
    &amp;lt;div class="options"&amp;gt;
      &amp;lt;button id="option1" class="option-btn" disabled&amp;gt;Option 1&amp;lt;/button&amp;gt;
      &amp;lt;button id="option2" class="option-btn" disabled&amp;gt;Option 2&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;button id="newQuestion" class="new-question"&amp;gt;New Question&amp;lt;/button&amp;gt;
    &amp;lt;div id="result" class="result"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;script src="script.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What’s happening here?&lt;/p&gt;

&lt;p&gt;The #question div displays the current "Would You Rather" prompt.&lt;br&gt;
Two buttons (#option1 and #option2) let users choose between options.&lt;br&gt;
The #newQuestion button fetches a new question.&lt;br&gt;
The #result div shows a response after a choice is made.&lt;br&gt;
Meta tags are included for SEO optimization.&lt;/p&gt;

&lt;p&gt;🛠️ Step 2: Style with CSS&lt;br&gt;
Next, let’s style the game to make it engaging and responsive. We’ll use flexbox for layout, add hover effects, and ensure the buttons are visually distinct.&lt;/p&gt;

&lt;p&gt;Here’s the CSS (styles.css):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background-color: #f4f4f4;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

h1 {
  color: #333;
}

.question {
  font-size: 1.5em;
  margin: 20px 0;
  padding: 20px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.options {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 20px;
}

.option-btn {
  padding: 12px 24px;
  font-size: 1em;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.option-btn:hover:not(:disabled) {
  background-color: #0056b3;
}

.option-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.new-question {
  padding: 12px 24px;
  font-size: 1em;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.new-question:hover {
  background-color: #218838;
}

.result {
  margin-top: 20px;
  font-size: 1.2em;
  color: #333;
}

@media (max-width: 600px) {
  .options {
    flex-direction: column;
    gap: 10px;
  }

  .option-btn, .new-question {
    width: 100%;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key styles:&lt;/p&gt;

&lt;p&gt;The .question div is styled with a card-like appearance for readability.&lt;br&gt;
The .option-btn and .new-question buttons have distinct colors (blue and green) and hover effects.&lt;br&gt;
The .options div uses flexbox to align buttons, switching to a column layout on mobile.&lt;br&gt;
Responsive design ensures usability on smaller screens.&lt;/p&gt;

&lt;p&gt;🛠️ Step 3: Add JavaScript Functionality&lt;br&gt;
Now, let’s bring the game to life with JavaScript. We’ll:&lt;/p&gt;

&lt;p&gt;Store a list of "Would You Rather" questions.&lt;br&gt;
Display a random question and its options.&lt;br&gt;
Handle user choices and show a fun response.&lt;br&gt;
Allow users to generate new questions.&lt;/p&gt;

&lt;p&gt;Here’s the JavaScript (script.js):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const questionEl = document.getElementById('question');
const option1Btn = document.getElementById('option1');
const option2Btn = document.getElementById('option2');
const newQuestionBtn = document.getElementById('newQuestion');
const resultEl = document.getElementById('result');

// Sample questions
const questions = [
  {
    question: 'Would you rather...',
    option1: 'Have a pet dragon',
    option2: 'Be a wizard',
    response1: 'Roaring success! A dragon would make every day epic!',
    response2: 'Abracadabra! Casting spells sounds magical!'
  },
  {
    question: 'Would you rather...',
    option1: 'Live in a treehouse',
    option2: 'Live underwater',
    response1: 'Tree-mendous choice! Nature’s your new neighbor!',
    response2: 'Dive in! Life under the sea is a splash!'
  },
  {
    question: 'Would you rather...',
    option1: 'Never sleep again',
    option2: 'Never eat again',
    response1: 'Night owl vibes! You’ll have endless time to hustle!',
    response2: 'Foodie sacrifice! You’re powered by pure willpower!'
  }
];

// Display a random question
function displayQuestion() {
  const randomIndex = Math.floor(Math.random() * questions.length);
  const currentQuestion = questions[randomIndex];

  questionEl.textContent = currentQuestion.question;
  option1Btn.textContent = currentQuestion.option1;
  option2Btn.textContent = currentQuestion.option2;
  option1Btn.disabled = false;
  option2Btn.disabled = false;
  resultEl.textContent = '';

  option1Btn.dataset.response = currentQuestion.response1;
  option2Btn.dataset.response = currentQuestion.response2;
}

// Handle option selection
function handleChoice(response) {
  resultEl.textContent = response;
  option1Btn.disabled = true;
  option2Btn.disabled = true;
}

// Event listeners
option1Btn.addEventListener('click', () =&amp;gt; handleChoice(option1Btn.dataset.response));
option2Btn.addEventListener('click', () =&amp;gt; handleChoice(option2Btn.dataset.response));
newQuestionBtn.addEventListener('click', displayQuestion);

// Initialize with a question
displayQuestion();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How it works:&lt;/p&gt;

&lt;p&gt;The questions array stores objects with a question, two options, and responses for each choice.&lt;br&gt;
The displayQuestion function picks a random question, updates the UI, and enables the option buttons.&lt;br&gt;
Clicking an option button displays its corresponding response and disables further selections until a new question is generated.&lt;br&gt;
The “New Question” button triggers a new random question.&lt;br&gt;
For simplicity, we use a small question set; you can expand it for variety.&lt;/p&gt;

&lt;p&gt;🚀 Step 4: Test and Deploy&lt;/p&gt;

&lt;p&gt;Test locally: Save the three files (index.html, styles.css, script.js) in a folder and open index.html in a browser. Click “New Question” to load a question, choose an option, and verify the response.&lt;br&gt;
Deploy: Host your game on platforms like GitHub Pages, Netlify, or Vercel for free.&lt;br&gt;
Enhance: Want to level up? Add features like:&lt;br&gt;
A voting system to track popular choices.&lt;br&gt;
Categories (funny, serious, gross) like those on Would You Rather. &lt;br&gt;
Local storage to save user choices or favorite questions.&lt;br&gt;
An API to fetch questions dynamically (e.g., from a public "Would You Rather" question database).&lt;/p&gt;

&lt;p&gt;🌟 Why Build Your Own?&lt;br&gt;
Building a "Would You Rather" game is a great way to practice DOM manipulation, event handling, and randomized content generation in JavaScript. It’s also a fun, shareable project that can entertain friends or engage an online audience. For inspiration, check out Would You Rather, a fantastic platform for wacky and tough choices that spark hilarious debates.&lt;br&gt;
Have questions or ideas to improve this game? Drop a comment below, and let’s make some tough choices together! 🎲&lt;/p&gt;

&lt;p&gt;Try the live demo here: &lt;a href="https://wouldyourather.cc" rel="noopener noreferrer"&gt;Would You Rather&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to Build a Color Wheel Picker Tool with HTML, CSS, and JavaScript</title>
      <dc:creator>Varinder Pal Singh</dc:creator>
      <pubDate>Fri, 16 May 2025 11:24:24 +0000</pubDate>
      <link>https://dev.to/varinder_palsingh_7e97d6/how-to-build-a-color-wheel-picker-tool-with-html-css-and-javascript-2g5b</link>
      <guid>https://dev.to/varinder_palsingh_7e97d6/how-to-build-a-color-wheel-picker-tool-with-html-css-and-javascript-2g5b</guid>
      <description>&lt;p&gt;A Color Wheel Picker is an interactive web tool that allows users to select colors from a circular color spectrum, often used to generate harmonious color palettes or pick specific hues. It’s a must-have for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🎨 Designers creating cohesive color schemes for branding or UI.
&lt;/li&gt;
&lt;li&gt;🖌️ Artists exploring color relationships for digital art.
&lt;/li&gt;
&lt;li&gt;💻 Developers building intuitive color selection interfaces.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqhsgeehkl7c6x144q9n0.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqhsgeehkl7c6x144q9n0.webp" alt="Color Wheel Picker Tool" width="799" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this beginner-friendly tutorial, you’ll build your own Color Wheel Picker inspired by &lt;a href="https://www.quickspinwheel.com" rel="noopener noreferrer"&gt;quickspinwheel.com&lt;/a&gt; using HTML, CSS, and JavaScript — no frameworks or external libraries required. By the end, you’ll have a functional tool where users can click or drag on a color wheel to select colors and view their HEX and RGB values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🛠️ Step 1: Create the HTML Structure&lt;/strong&gt;&lt;br&gt;
Let’s start with a simple HTML structure. We need:&lt;/p&gt;

&lt;p&gt;A canvas to render the color wheel.&lt;br&gt;
A div to display the selected color and its HEX/RGB codes.&lt;br&gt;
A button to copy the color code to the clipboard.&lt;/p&gt;

&lt;p&gt;Here’s the HTML (index.html):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"description"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"Learn how to build a Color Wheel Picker tool with HTML, CSS, and JavaScript to select colors interactively."&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"keywords"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"Color Wheel Picker, web development, HTML, CSS, JavaScript, tutorial"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"author"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"Your Name"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Color Wheel Picker Tool&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"styles.css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Color Wheel Picker Tool&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Inspired by &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://www.quickspinwheel.com"&lt;/span&gt; &lt;span class="na"&gt;target=&lt;/span&gt;&lt;span class="s"&gt;"_blank"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Color Wheel Picker&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;canvas&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"colorWheel"&lt;/span&gt; &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"300"&lt;/span&gt; &lt;span class="na"&gt;height=&lt;/span&gt;&lt;span class="s"&gt;"300"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/canvas&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"color-info"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"colorPreview"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"color-preview"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"colorCode"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Select a color&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"copyButton"&lt;/span&gt; &lt;span class="na"&gt;disabled&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Copy HEX Code&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"script.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What’s happening here?&lt;/p&gt;

&lt;p&gt;The  element will display the color wheel.&lt;br&gt;
The .color-info section shows a preview of the selected color and its HEX/RGB codes.&lt;br&gt;
The copy button allows users to copy the HEX code to the clipboard.&lt;br&gt;
Meta tags are included for SEO optimization.&lt;/p&gt;

&lt;p&gt;🛠️ Step 2: Style with CSS&lt;br&gt;
Next, let’s style the page to make it clean and user-friendly. We’ll center the content, style the canvas, and ensure the layout is responsive.&lt;/p&gt;

&lt;p&gt;Here’s the CSS (styles.css):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Arial&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#f4f4f4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;600px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#333&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;canvas&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#ddd&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;crosshair&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.color-info&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;gap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.color-preview&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#333&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#007bff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;background-color&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="nd"&gt;:disabled&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#ccc&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;not-allowed&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="nd"&gt;:hover:not&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nd"&gt;:disabled&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#0056b3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;600px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nt"&gt;canvas&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;250px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;250px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nc"&gt;.color-info&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key styles:&lt;/p&gt;

&lt;p&gt;The canvas is styled as a circle with border-radius: 50% and a crosshair cursor for color picking.&lt;br&gt;
The color preview is a small square that updates with the selected color.&lt;br&gt;
The button has a hover effect and disabled state.&lt;br&gt;
Responsive design adjusts the canvas size and layout for mobile devices.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🛠️ Step 3: Add JavaScript Functionality&lt;/strong&gt;&lt;br&gt;
Now, let’s create the color wheel and enable color picking. We’ll:&lt;/p&gt;

&lt;p&gt;Draw a color wheel on the canvas using HSL colors.&lt;br&gt;
Detect mouse clicks or drags to pick colors.&lt;br&gt;
Display the selected color and its HEX/RGB codes.&lt;br&gt;
Enable copying the HEX code to the clipboard.&lt;/p&gt;

&lt;p&gt;Here’s the JavaScript (script.js):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;colorWheel&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2d&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;colorPreview&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;colorPreview&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;colorCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;colorCode&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;copyButton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;copyButton&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Draw color wheel&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;drawColorWheel&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;radius&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;imageData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createImageData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;dx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;dy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;distance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dx&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;dx&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;dy&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;dy&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;angle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;atan2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dy&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;dx&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

      &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;distance&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nx"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;hue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;angle&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PI&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PI&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;saturation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;distance&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;rgb&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;hslToRgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;hue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;saturation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;imageData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
        &lt;span class="nx"&gt;imageData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
        &lt;span class="nx"&gt;imageData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
        &lt;span class="nx"&gt;imageData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;putImageData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;imageData&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Convert HSL to RGB&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;hslToRgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;h&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;q&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;s&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;q&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;hueToRgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;q&lt;/span&gt; &lt;span class="nx"&gt;clásico&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;h&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;hueToRgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;q&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;h&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;hueToRgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;q&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;h&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;g&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;)];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;hueToRgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;q&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;p&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;q&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;q&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;p&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;q&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Convert RGB to HEX&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;rgbToHex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`#&lt;/span&gt;&lt;span class="p"&gt;${((&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;g&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toUpperCase&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Pick color on canvas interaction&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;pickColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;rect&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getBoundingClientRect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientX&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;rect&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;left&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientY&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;rect&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;top&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pixel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getImageData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;hex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;rgbToHex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pixel&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nx"&gt;pixel&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nx"&gt;pixel&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

  &lt;span class="nx"&gt;colorPreview&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;backgroundColor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;hex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;colorCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`HEX: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;hex&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; | RGB: (&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;pixel&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;pixel&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;pixel&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;&lt;span class="s2"&gt;)`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;copyButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;disabled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;copyButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dataset&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;color&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;hex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Event listeners for color picking&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;isDragging&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mousedown&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;isDragging&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;pickColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mousemove&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isDragging&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;pickColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mouseup&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;isDragging&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mouseleave&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;isDragging&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Copy color code to clipboard&lt;/span&gt;
&lt;span class="nx"&gt;copyButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;copyButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dataset&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nb"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clipboard&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;HEX code copied to clipboard!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Initialize color wheel&lt;/span&gt;
&lt;span class="nf"&gt;drawColorWheel&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How it works:&lt;/p&gt;

&lt;p&gt;The drawColorWheel function creates a color wheel by mapping HSL colors to a circular canvas, with hue determined by the angle and saturation by the distance from the center.&lt;br&gt;
The hslToRgb and hueToRgb functions convert HSL values to RGB for rendering.&lt;br&gt;
Mouse events (mousedown, mousemove, mouseup) allow users to click or drag to pick colors, retrieving pixel data with ctx.getImageData.&lt;br&gt;
The selected color’s HEX and RGB values are displayed, and the HEX code can be copied using the Clipboard API.&lt;/p&gt;

&lt;p&gt;🚀 Step 4: Test and Deploy&lt;/p&gt;

&lt;p&gt;Test locally: Save the three files (index.html, styles.css, script.js) in a folder and open index.html in a browser. Click or drag on the color wheel to pick colors and copy the HEX code.&lt;br&gt;
Deploy: Host your tool on platforms like GitHub Pages, Netlify, or Vercel for free.&lt;br&gt;
Enhance: Want to take it further? Add features like:&lt;br&gt;
Support for HSL or CMYK color formats.&lt;br&gt;
A palette generator for complementary or analogous colors.&lt;br&gt;
A brightness slider to adjust the lightness value.&lt;/p&gt;

&lt;p&gt;🌟 Why Build Your Own?&lt;br&gt;
Creating a Color Wheel Picker is a fantastic way to practice canvas rendering, color theory, and event handling in JavaScript. It’s also a versatile tool for designers and developers. For inspiration, check out Color Wheel Picker, a powerful tool for generating random palettes and extracting colors.&lt;br&gt;
Have questions or ideas to improve this tool? Drop a comment below, and let’s create something vibrant together!&lt;/p&gt;

&lt;p&gt;Try the live demo here: &lt;a href="https://www.quickspinwheel.com" rel="noopener noreferrer"&gt;Color Wheel Picker&lt;/a&gt;&lt;br&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to Build a Grade Calculator Tool with HTML, CSS, and JavaScript</title>
      <dc:creator>Varinder Pal Singh</dc:creator>
      <pubDate>Fri, 16 May 2025 11:20:13 +0000</pubDate>
      <link>https://dev.to/varinder_palsingh_7e97d6/how-to-build-a-grade-calculator-tool-with-html-css-and-javascript-24g5</link>
      <guid>https://dev.to/varinder_palsingh_7e97d6/how-to-build-a-grade-calculator-tool-with-html-css-and-javascript-24g5</guid>
      <description>&lt;p&gt;A grade calculator tool is a practical web application that helps students calculate their weighted course grades based on assignment scores and their respective weights. It’s incredibly useful for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🎓 Students tracking their academic progress.
&lt;/li&gt;
&lt;li&gt;📚 Educators verifying grades for assignments or courses.
&lt;/li&gt;
&lt;li&gt;🧠 Anyone aiming to strategize for a target GPA.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzj5488cd24dytsji5iz5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzj5488cd24dytsji5iz5.jpg" alt="Grade Calculator Tool" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this beginner-friendly tutorial, you’ll build your own grade calculator inspired by &lt;a href="https://gradecalculator.college" rel="noopener noreferrer"&gt;gradecalculator.college&lt;/a&gt; using HTML, CSS, and JavaScript — no frameworks or external libraries required. By the end, you’ll have a functional tool where users can input assignment grades and weights, calculate their weighted average, and see their overall course grade.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🛠️ Step 1: Create the HTML Structure&lt;/strong&gt;&lt;br&gt;
Let’s start with a clean HTML structure. We need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A form to input assignment names, grades, and weights.&lt;/li&gt;
&lt;li&gt;A button to calculate the weighted grade.&lt;/li&gt;
&lt;li&gt;A section to display the result.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s the HTML (index.html):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;meta charset="UTF-8"&amp;gt;
  &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
  &amp;lt;meta name="description" content="Learn how to build a grade calculator tool with HTML, CSS, and JavaScript to track weighted course grades."&amp;gt;
  &amp;lt;meta name="keywords" content="grade calculator, web development, HTML, CSS, JavaScript, tutorial"&amp;gt;
  &amp;lt;meta name="author" content="Your Name"&amp;gt;
  &amp;lt;title&amp;gt;Grade Calculator Tool&amp;lt;/title&amp;gt;
  &amp;lt;link rel="stylesheet" href="styles.css"&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;div class="container"&amp;gt;
    &amp;lt;h1&amp;gt;Grade Calculator Tool&amp;lt;/h1&amp;gt;
    &amp;lt;form id="gradeForm"&amp;gt;
      &amp;lt;div id="assignments"&amp;gt;
        &amp;lt;div class="assignment"&amp;gt;
          &amp;lt;input type="text" placeholder="Assignment Name" class="assignment-name"&amp;gt;
          &amp;lt;input type="number" placeholder="Grade (%)" class="grade" min="0" max="100" step="0.01"&amp;gt;
          &amp;lt;input type="number" placeholder="Weight (%)" class="weight" min="0" max="100" step="0.01"&amp;gt;
          &amp;lt;button type="button" class="remove-btn"&amp;gt;Remove&amp;lt;/button&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;button type="button" id="addAssignment"&amp;gt;+ Add Assignment&amp;lt;/button&amp;gt;
      &amp;lt;button type="submit" id="calculate"&amp;gt;Calculate Grade&amp;lt;/button&amp;gt;
    &amp;lt;/form&amp;gt;
    &amp;lt;div id="result" class="result"&amp;gt;
      &amp;lt;h2&amp;gt;Your Weighted Grade: &amp;lt;span id="weightedGrade"&amp;gt;N/A&amp;lt;/span&amp;gt;&amp;lt;/h2&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;script src="script.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What’s happening here?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The form contains a dynamic list of assignments, each with inputs for name, grade (as a percentage), and weight (as a percentage).&lt;/li&gt;
&lt;li&gt;The “Add Assignment” button allows users to add more rows.&lt;/li&gt;
&lt;li&gt;The “Calculate” button triggers the grade calculation.&lt;/li&gt;
&lt;li&gt;The result section displays the weighted average grade.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🛠️ Step 2: Style with CSS&lt;/strong&gt;&lt;br&gt;
Next, let’s style the calculator to make it intuitive and visually appealing. We’ll use flexbox for layout, ensure inputs are clear, and add responsive design for mobile users.&lt;br&gt;
Here’s the CSS (styles.css):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background-color: #f4f4f4;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

h1 {
  color: #333;
}

form {
  margin-top: 20px;
}

.assignment {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}

input {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: 100%;
}

.assignment-name {
  flex: 2;
}

.grade, .weight {
  flex: 1;
}

button {
  padding: 8px 16px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

button:hover {
  background-color: #0056b3;
}

.remove-btn {
  background-color: #dc3545;
}

.remove-btn:hover {
  background-color: #b02a37;
}

#addAssignment {
  margin: 10px 0;
  background-color: #28a745;
}

#addAssignment:hover {
  background-color: #218838;
}

.result {
  margin-top: 20px;
}

.result h2 {
  color: #333;
}

@media (max-width: 600px) {
  .assignment {
    flex-direction: column;
  }

  input, button {
    width: 100%;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key styles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The .assignment div uses flexbox to align inputs and the remove button.&lt;/li&gt;
&lt;li&gt;Buttons have distinct colors for add (green), remove (red), and calculate (blue) actions.&lt;/li&gt;
&lt;li&gt;The layout switches to a column on mobile devices for better usability.&lt;/li&gt;
&lt;li&gt;Inputs are styled for clarity with borders and padding.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🛠️ Step 3: Add JavaScript Functionality&lt;/strong&gt;&lt;br&gt;
Now, let’s add the logic to make the grade calculator work. We’ll:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allow users to add or remove assignment rows.&lt;/li&gt;
&lt;li&gt;Validate inputs and calculate the weighted average grade.&lt;/li&gt;
&lt;li&gt;Display the result with proper formatting.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s the JavaScript (script.js):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const gradeForm = document.getElementById('gradeForm');
const assignmentsContainer = document.getElementById('assignments');
const addAssignmentBtn = document.getElementById('addAssignment');
const weightedGradeSpan = document.getElementById('weightedGrade');

// Add new assignment row
addAssignmentBtn.addEventListener('click', () =&amp;gt; {
  const assignmentDiv = document.createElement('div');
  assignmentDiv.classList.add('assignment');
  assignmentDiv.innerHTML = `
    &amp;lt;input type="text" placeholder="Assignment Name" class="assignment-name"&amp;gt;
    &amp;lt;input type="number" placeholder="Grade (%)" class="grade" min="0" max="100" step="0.01"&amp;gt;
    &amp;lt;input type="number" placeholder="Weight (%)" class="weight" min="0" max="100" step="0.01"&amp;gt;
    &amp;lt;button type="button" class="remove-btn"&amp;gt;Remove&amp;lt;/button&amp;gt;
  `;
  assignmentsContainer.appendChild(assignmentDiv);
});

// Remove assignment row
assignmentsContainer.addEventListener('click', (e) =&amp;gt; {
  if (e.target.classList.contains('remove-btn')) {
    e.target.parentElement.remove();
  }
});

// Calculate weighted grade
gradeForm.addEventListener('submit', (e) =&amp;gt; {
  e.preventDefault();

  const grades = document.querySelectorAll('.grade');
  const weights = document.querySelectorAll('.weight');

  let totalWeightedGrade = 0;
  let totalWeight = 0;

  for (let i = 0; i &amp;lt; grades.length; i++) {
    const grade = parseFloat(grades[i].value);
    const weight = parseFloat(weights[i].value);

    if (isNaN(grade) || isNaN(weight)) {
      alert('Please fill in all grade and weight fields.');
      return;
    }

    totalWeightedGrade += (grade * weight) / 100;
    totalWeight += weight;
  }

  if (totalWeight !== 100) {
    alert('Weights must sum to 100%.');
    return;
  }

  const weightedGrade = totalWeightedGrade.toFixed(2);
  weightedGradeSpan.textContent = `${weightedGrade}%`;
});

// Prevent form submission on Enter key
gradeForm.addEventListener('keydown', (e) =&amp;gt; {
  if (e.key === 'Enter') {
    e.preventDefault();
  }
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clicking “Add Assignment” dynamically adds a new row with inputs and a remove button.&lt;/li&gt;
&lt;li&gt;Clicking “Remove” deletes the respective assignment row.&lt;/li&gt;
&lt;li&gt;On form submission, the script collects grades and weights, calculates the weighted average using the formula: Weighted Grade = Σ(Grade * Weight) / 100, and ensures weights sum to 100%.&lt;/li&gt;
&lt;li&gt;The result is displayed as a percentage, rounded to two decimal places.&lt;/li&gt;
&lt;li&gt;Input validation prevents empty fields or incorrect weight sums.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🚀 Step 4: Test and Deploy&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Test locally: Save the three files (index.html, styles.css, script.js) in a folder and open index.html in a browser. Add assignments, input grades and weights, and verify the calculation.&lt;/li&gt;
&lt;li&gt;Deploy: Host your tool on platforms like GitHub Pages, Netlify, or Vercel for free.&lt;/li&gt;
&lt;li&gt;Enhance: Want to level up? Add features like:&lt;/li&gt;
&lt;li&gt;Support for letter grades (A, B, etc.) with automatic conversion to percentages.&lt;/li&gt;
&lt;li&gt;A goal-setting feature to calculate required grades for a target course grade.&lt;/li&gt;
&lt;li&gt;Persistent storage using localStorage to save assignments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🌟 Why Build Your Own?&lt;/strong&gt;&lt;br&gt;
Building a grade calculator is an excellent way to practice dynamic DOM manipulation, form handling, and basic math operations in JavaScript. It’s also a practical tool you can use or share with classmates. For inspiration, check out Grade Calculator, a robust tool for tracking academic performance.&lt;br&gt;
Have questions or ideas to improve this tool? Drop a comment below, and let’s calculate some grades together!&lt;/p&gt;

&lt;p&gt;Try the live demo here: &lt;a href="https://gradecalculator.college" rel="noopener noreferrer"&gt;Grade Calculator&lt;/a&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to Build a Color Picker Tool with HTML, CSS, and JavaScript</title>
      <dc:creator>Varinder Pal Singh</dc:creator>
      <pubDate>Fri, 16 May 2025 11:15:13 +0000</pubDate>
      <link>https://dev.to/varinder_palsingh_7e97d6/how-to-build-a-color-picker-tool-with-html-css-and-javascript-35ph</link>
      <guid>https://dev.to/varinder_palsingh_7e97d6/how-to-build-a-color-picker-tool-with-html-css-and-javascript-35ph</guid>
      <description>&lt;p&gt;A color picker tool is an interactive web utility that lets users select colors from an image or a canvas and retrieve their HEX, RGB, or HSL values. It’s a fantastic tool for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🎨 Designers picking colors for branding or UI.
&lt;/li&gt;
&lt;li&gt;💻 Developers extracting colors from mockups.
&lt;/li&gt;
&lt;li&gt;🖼️ Artists exploring color palettes from images.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1byc0fp1a3a8vk9lzz2u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1byc0fp1a3a8vk9lzz2u.png" alt="Color Picker Tool" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this beginner-friendly tutorial, you’ll build your own color picker tool inspired by &lt;a href="https://colorpickimage.com" rel="noopener noreferrer"&gt;ColorPickImage.com&lt;/a&gt; using HTML, CSS, and JavaScript — no frameworks or external libraries needed. By the end, you’ll have a functional web app where users can upload an image, pick colors, and copy color codes.&lt;/p&gt;

&lt;p&gt;🛠️ Step 1: Create the HTML Structure&lt;br&gt;
Let’s start with a simple HTML structure. We need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A canvas to display the uploaded image.&lt;/li&gt;
&lt;li&gt;An input for image uploads.&lt;/li&gt;
&lt;li&gt;A div to show the selected color and its code.&lt;/li&gt;
&lt;li&gt;A button to copy the color code to the clipboard.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s the HTML:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;meta charset="UTF-8"&amp;gt;
  &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
  &amp;lt;meta name="description" content="Learn how to build a color picker tool with HTML, CSS, and JavaScript to select colors from images."&amp;gt;
  &amp;lt;meta name="keywords" content="color picker, web development, HTML, CSS, JavaScript, tutorial"&amp;gt;
  &amp;lt;meta name="author" content="Your Name"&amp;gt;
  &amp;lt;title&amp;gt;Color Picker Tool&amp;lt;/title&amp;gt;
  &amp;lt;link rel="stylesheet" href="styles.css"&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;div class="container"&amp;gt;
    &amp;lt;h1&amp;gt;Color Picker Tool&amp;lt;/h1&amp;gt;
    &amp;lt;p&amp;gt;Inspired by &amp;lt;a href="https://colorpickimage.com/" target="_blank"&amp;gt;ColorPickImage.com&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;input type="file" id="imageUpload" accept="image/*"&amp;gt;
    &amp;lt;canvas id="canvas"&amp;gt;&amp;lt;/canvas&amp;gt;
    &amp;lt;div class="color-info"&amp;gt;
      &amp;lt;div id="colorPreview" class="color-preview"&amp;gt;&amp;lt;/div&amp;gt;
      &amp;lt;p id="colorCode"&amp;gt;Select a color&amp;lt;/p&amp;gt;
      &amp;lt;button id="copyButton" disabled&amp;gt;Copy Color Code&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;script src="script.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What’s happening here?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The  lets users upload an image.&lt;/li&gt;
&lt;li&gt;The  will display the image and handle color picking.&lt;/li&gt;
&lt;li&gt;The .color-info section shows a preview of the selected color and its HEX code.&lt;/li&gt;
&lt;li&gt;The copy button will copy the color code to the clipboard.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🛠️ Step 2: Style with CSS&lt;br&gt;
Next, let’s style the page to make it clean and user-friendly. We’ll use flexbox for layout, add some hover effects, and ensure the canvas resizes responsively.&lt;/p&gt;

&lt;p&gt;Here’s the CSS (styles.css):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background-color: #f4f4f4;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

h1 {
  color: #333;
}

input[type="file"] {
  margin: 20px 0;
  padding: 10px;
}

canvas {
  max-width: 100%;
  border: 2px solid #ddd;
  cursor: crosshair;
}

.color-info {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.color-preview {
  width: 50px;
  height: 50px;
  border: 2px solid #333;
  border-radius: 5px;
}

button {
  padding: 10px 20px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

button:hover:not(:disabled) {
  background-color: #0056b3;
}

@media (max-width: 600px) {
  .color-info {
    flex-direction: column;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key styles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The canvas has a crosshair cursor to indicate color picking.&lt;/li&gt;
&lt;li&gt;The color preview is a small square that updates with the selected color.&lt;/li&gt;
&lt;li&gt;The button is styled with a hover effect and disabled state.&lt;/li&gt;
&lt;li&gt;Responsive design ensures the layout works on mobile devices.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🛠️ Step 3: Add JavaScript Functionality&lt;br&gt;
Now, let’s bring the color picker to life with JavaScript. We’ll:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Handle image uploads and draw the image on the canvas.&lt;/li&gt;
&lt;li&gt;Detect mouse clicks on the canvas to pick colors.&lt;/li&gt;
&lt;li&gt;Display the color and its HEX code.&lt;/li&gt;
&lt;li&gt;Enable copying the color code to the clipboard.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s the JavaScript (script.js):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const imageUpload = document.getElementById('imageUpload');
const colorPreview = document.getElementById('colorPreview');
const colorCode = document.getElementById('colorCode');
const copyButton = document.getElementById('copyButton');

let img = new Image();

// Handle image upload
imageUpload.addEventListener('change', (e) =&amp;gt; {
  const file = e.target.files[0];
  if (file) {
    const reader = new FileReader();
    reader.onload = (event) =&amp;gt; {
      img.src = event.target.result;
      img.onload = () =&amp;gt; {
        canvas.width = img.width;
        canvas.height = img.height;
        ctx.drawImage(img, 0, 0);
      };
    };
    reader.readAsDataURL(file);
  }
});

// Pick color on canvas click
canvas.addEventListener('click', (e) =&amp;gt; {
  const rect = canvas.getBoundingClientRect();
  const x = e.clientX - rect.left;
  const y = e.clientY - rect.top;

  const pixel = ctx.getImageData(x, y, 1, 1).data;
  const hex = rgbToHex(pixel[0], pixel[1], pixel[2]);

  colorPreview.style.backgroundColor = hex;
  colorCode.textContent = `HEX: ${hex}`;
  copyButton.disabled = false;
  copyButton.dataset.color = hex;
});

// Convert RGB to HEX
function rgbToHex(r, g, b) {
  return `#${((1 &amp;lt;&amp;lt; 24) + (r &amp;lt;&amp;lt; 16) + (g &amp;lt;&amp;lt; 8) + b).toString(16).slice(1).toUpperCase()}`;
}

// Copy color code to clipboard
copyButton.addEventListener('click', () =&amp;gt; {
  const color = copyButton.dataset.color;
  navigator.clipboard.writeText(color).then(() =&amp;gt; {
    alert('Color code copied to clipboard!');
  });
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How it works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When an image is uploaded, it’s loaded into the canvas using a FileReader.&lt;/li&gt;
&lt;li&gt;Clicking the canvas gets the pixel data at the click position using ctx.getImageData.&lt;/li&gt;
&lt;li&gt;The RGB values are converted to a HEX code and displayed.&lt;/li&gt;
&lt;li&gt;The copy button uses the Clipboard API to copy the HEX code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🚀 Step 4: Test and Deploy&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Test locally: Save the three files (index.html, styles.css, script.js) in a folder and open index.html in a browser. Upload an image, click to pick a color, and copy the HEX code.&lt;/li&gt;
&lt;li&gt;Deploy: Host your tool on platforms like GitHub Pages, Netlify, or Vercel for free.&lt;/li&gt;
&lt;li&gt;Enhance: Want to take it further? Add features like:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Support for RGB and HSL formats.&lt;br&gt;
A zoom feature for precise picking.&lt;br&gt;
A history of picked colors.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;🌟 Why Build Your Own?&lt;br&gt;
Creating a color picker tool is a great way to practice canvas manipulation, event handling, and DOM interactions. Plus, you can customize it to suit your needs. For inspiration, check out ColorPickImage.com, a fantastic tool for color picking from images.&lt;/p&gt;

&lt;p&gt;Have questions or ideas to improve this tool? Drop a comment below, and let’s build something colorful together! 🎨&lt;/p&gt;

&lt;p&gt;Try the live demo here: &lt;a href="https://colorpickimage.com" rel="noopener noreferrer"&gt;Color Pick from Image&lt;/a&gt;&lt;br&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to Build a White Screen Tool with HTML, CSS, and JavaScript</title>
      <dc:creator>Varinder Pal Singh</dc:creator>
      <pubDate>Fri, 16 May 2025 10:36:57 +0000</pubDate>
      <link>https://dev.to/varinder_palsingh_7e97d6/what-is-a-white-screen-tool-and-how-to-use-it-with-live-demo-3nb7</link>
      <guid>https://dev.to/varinder_palsingh_7e97d6/what-is-a-white-screen-tool-and-how-to-use-it-with-live-demo-3nb7</guid>
      <description>&lt;p&gt;A &lt;strong&gt;white screen tool&lt;/strong&gt; is a simple utility that turns your browser into a blank, fullscreen white canvas. It’s surprisingly useful:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📸 Photographers use it for lighting.
&lt;/li&gt;
&lt;li&gt;🧪 Developers use it to test screens.
&lt;/li&gt;
&lt;li&gt;💡 Some use it to brighten their room or reduce distractions.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl0xvtvx18mtungq2tb23.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl0xvtvx18mtungq2tb23.webp" alt="White Screen Tool " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this quick tutorial, you’ll build your own white screen page using just &lt;strong&gt;HTML, CSS, and JavaScript&lt;/strong&gt; — no libraries or frameworks required.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Step 1: Create the HTML
&lt;/h2&gt;

&lt;p&gt;We’ll start with a minimal structure and a button that will trigger the white screen mode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;meta charset="UTF-8" /&amp;gt;
  &amp;lt;title&amp;gt;White Screen Tool&amp;lt;/title&amp;gt;
  &amp;lt;link rel="stylesheet" href="styles.css" /&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;button class="button" onclick="goWhiteScreen()"&amp;gt;Go Fullscreen White&amp;lt;/button&amp;gt;
  &amp;lt;script src="script.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🎨 Step 2: Style the Page with CSS&lt;br&gt;
We’ll make the button look nice and set up a class to make the background white when activated.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* styles.css */
body {
  font-family: sans-serif;
  text-align: center;
  padding: 2rem;
  background: #f9f9f9;
  color: #333;
}

.button {
  padding: 1rem 2rem;
  font-size: 1.2rem;
  background-color: #0077cc;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.button:hover {
  background-color: #005fa3;
}

.white-mode {
  background-color: white;
  color: white;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🧠 Step 3: Add JavaScript to Go Fullscreen&lt;br&gt;
We’ll add a small script that applies the white-mode class and uses the Fullscreen API.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// script.js
function goWhiteScreen() {
  document.body.classList.add("white-mode");

  if (document.documentElement.requestFullscreen) {
    document.documentElement.requestFullscreen();
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ You’re Done! Try It Live&lt;br&gt;
You now have a fully working white screen tool. Click the button to test it — it goes fullscreen and turns the screen white.&lt;/p&gt;

&lt;p&gt;👉 Want a full‑featured version with dark mode toggle and zero distractions?&lt;br&gt;
Try the live demo here: &lt;a href="https://whitescreen.run" rel="noopener noreferrer"&gt;whitescreen.run&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bonus Ideas&lt;/strong&gt;&lt;br&gt;
Want to expand on this? Here are a few suggestions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🌙 Add a dark mode toggle.&lt;/li&gt;
&lt;li&gt;⌨️ Use keyboard shortcuts to toggle white mode.&lt;/li&gt;
&lt;li&gt;🕹️ Auto-enable fullscreen when the page loads.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;br&gt;
Sometimes the simplest tools are the most effective. This project is a great starter for experimenting with the Fullscreen API, toggling styles, and learning how to build clean utility tools with just a few lines of code.&lt;/p&gt;

&lt;p&gt;Feel free to fork it, enhance it, and share your version!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>css</category>
      <category>html</category>
    </item>
  </channel>
</rss>
