Skip to content

Fix margin and background processing order#23

Open
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
devin/MAN8-4791-1749662603
Open

Fix margin and background processing order#23
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
devin/MAN8-4791-1749662603

Conversation

@devin-ai-integration
Copy link
Contributor

Fix margin and background processing order

Issue Description

When both margin and background are specified in a variant configuration, the margin areas remain transparent instead of using the specified background color. This happens because the margin is applied before the background in the processing pipeline.

Changes Made

1. Reordered operations in processImage method

  • Moved background application to before margin application
  • This ensures the background color is set before margins are added

2. Updated applyMargin method signature

  • Added optional background parameter to accept background color
  • Use provided background or default to transparent if none is provided
  • Replace hardcoded transparent background in extend() call with the background parameter

3. Applied same changes to ICO generation path

  • Updated generateMultiSizeIcoFile method to follow same pattern
  • Apply background before margin and pass background color to margin application

Implementation Details

  • Background color parsing uses existing parseBackgroundColor utility
  • When no background color is specified, maintains current behavior of transparent margins
  • Changes applied consistently in both main processing path and ICO generation path

Testing

  • All existing tests pass (73/73)
  • Lint checks pass
  • No breaking changes to existing functionality

Fixes MAN8-4791


Link to Devin run: https://app.devin.ai/sessions/3b8769218ed24ce79679a8da9b8b7a16
Requested by: Louis Mandelstam (louis@man8.com)

…ore margin

- Reorder operations in processImage method to apply background before margin
- Update applyMargin method signature to accept background parameter
- Apply same changes to ICO generation path in generateMultiSizeIcoFile
- Use parseBackgroundColor utility for background parameter passing
- Maintain transparent background as default when no background specified

Fixes MAN8-4791

Co-Authored-By: Louis Mandelstam <louis@man8.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration bot and others added 2 commits June 11, 2025 17:25
…der fix

- Add changelog entry for margin and background processing order fix
- Update README transformation order documentation to reflect correct sequence
- Background now correctly documented as applied before margin

Co-Authored-By: Louis Mandelstam <louis@man8.com>
- Update documentation to reflect that margins now use specified background colour
- Clarify that margins are only transparent when no background is specified
- Remove outdated claims that margins are always transparent

Co-Authored-By: Louis Mandelstam <louis@man8.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant