A simple web-based tool to extract the dominant colors from an uploaded image file. It analyzes the image using HTML Canvas and displays a palette of the most prominent colors found. ✨
- 🖼️ Image Upload: Select JPG, PNG, GIF, etc., from your device.
- 👁️ Image Preview: See a small preview of your uploaded image.
- 🎨 Dominant Color Extraction: Analyzes pixels to find the most frequent color groups using a binning technique.
- 🌈 Palette Display: Shows extracted colors as visual swatches.
- #️⃣ HEX Code Display: Provides the hexadecimal code for each color.
- 🖱️ Click-to-Copy: Easily copy HEX codes by clicking the swatches.
- 📱 Responsive Design: Adapts to different screen sizes.
- ⏳ Loading Indicator: Shows visual feedback during processing.
- 💬 User Feedback: Displays success or error messages.
- Clone this repository or download the files.
- Open the
index.html
file in your web browser. - Click the "Choose Image File" button and select your image.
- A preview and filename will appear.
- Click the "Extract Colors" button.
- Wait for the ⏳ analysis.
- The dominant colors 🎨 will appear below.
- Click any color swatch to copy its HEX code! ✨
- HTML: Page structure.
- CSS (Tailwind CSS): Styling & layout (via CDN).
- JavaScript: File handling, image preview, canvas manipulation, color analysis, DOM updates, user interactions.
- HTML Canvas API: Used to draw the image and access pixel data.
Contributions are welcome! 🎉 Whether it's bug fixes, feature additions, or documentation improvements, please feel free to contribute.
How to Contribute:
- Fork the Repository: Click the 'Fork' button at the top right of the repository page.
- Clone Your Fork
- Create a New Branch: Create a descriptive branch name for your changes.
git checkout -b feature/your-awesome-feature # or git checkout -b fix/issue-description
- Make Your Changes: Implement your feature or fix the bug.
- Test Your Changes: Ensure your changes work as expected and don't break existing functionality.
- Commit Your Changes: Write clear and concise commit messages.
(Consider using Conventional Commits for commit messages).
git add . git commit -m "feat: Add awesome new feature" # or git commit -m "fix: Resolve issue with color calculation"
- Push to Your Fork:
git push origin feature/your-awesome-feature
- Open a Pull Request (PR): Go to the original repository on GitHub and open a Pull Request from your forked branch to the main branch of the original repository.
- Provide a clear title and description for your PR.
- Reference any related issues (e.g., "Closes #123").
Reporting Bugs:
- Use the GitHub Issues tab.
- Provide a clear title and description.
- Include steps to reproduce the bug.
- Mention your browser and operating system if relevant.
Suggesting Enhancements:
- Use the GitHub Issues tab.
- Provide a clear title and detailed description of the proposed enhancement and its potential benefits.
- Advanced Algorithms: Implement k-means clustering or Median Cut for color quantization.
- Palette Size: Allow users to select the number of colors (e.g., 4, 8, 16).
- Color Formats: Add options to copy RGB or HSL values.
- Background Removal: Option to ignore large background areas.
- Drag & Drop: Implement drag-and-drop image uploads.
- Performance: Optimize JS, potentially using Web Workers.
Happy Coding! 💻