🧹 Simplify named colors mapping in DotWave#7
Conversation
Simplify the `namedColors` map in `src/dotwave.js` by storing only the RGB string values instead of the entire string format. Extracted alpha string interpolation to the point of function return. Co-authored-by: jsem-nerad <88319121+jsem-nerad@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull request overview
This PR refactors the _getRGBA named color handling in DotWave to reduce repetition by storing only the RGB triplets in the namedColors map and appending alpha at return time. The same change is reflected in the bundled src/dotwave.min.js so distributed usage stays consistent.
Changes:
- Simplified
_getRGBAnamed color map values from fullrgba(...)strings to RGB triplets and centralized thealphaformatting. - Updated
src/dotwave.min.jsto match the new_getRGBAbehavior.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/dotwave.js | Refactors namedColors entries and returns rgba(${rgb}, ${alpha}) for named colors. |
| src/dotwave.min.js | Updates the minified build’s _getRGBA implementation to match the source refactor. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
🎯 What: The predefined
namedColorsmap inside_getRGBAinsrc/dotwave.jswas simplified to store only the RGB values instead of repeating the string concatenation foralphaon every line.💡 Why: This refactoring reduces repetitive string format code, avoids concatenating variables on every map entry, and keeps the configuration cleaner and easier to read or add to in the future.
✅ Verification: Ran Node syntax check on
src/dotwave.jsto ensure no errors were introduced. Requested code review, which passed.✨ Result: Improved codebase readability and maintainability without altering the functional output of
_getRGBA.PR created automatically by Jules for task 6076524489690250700 started by @jsem-nerad