Skip to content

feat: Independent color settings per background type#471

Merged
ullbergm merged 4 commits intomainfrom
copilot/add-more-granular-settings
Nov 6, 2025
Merged

feat: Independent color settings per background type#471
ullbergm merged 4 commits intomainfrom
copilot/add-more-granular-settings

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 6, 2025

Background types (solid, gradient, geopattern) previously shared color state. Changing gradient colors would overwrite the solid color when switching back.

Changes

Data Model

  • Added typeColors object storing per-type color state:
    typeColors: {
      solid: { color: '#FF0000' },
      gradient: { color: '#0000FF', secondaryColor: '#00FF00', gradientDirection: 'to right' },
      geopattern: { color: '#F8F6F1' }
    }

State Management (useBackgroundPreferences.js)

  • Migration logic for existing preferences (preserves current colors)
  • updatePreference() now writes to type-specific path when updating color, secondaryColor, or gradientDirection
  • getBackgroundStyle() reads from active type's color settings
  • Maintains global fields for backward compatibility

UI (BackgroundSettings.jsx)

  • Color inputs bound to current type's values
  • Gradient-specific properties only update when type is gradient

Tests

  • Added verification that solid→gradient→solid color transitions preserve independent state
  • Updated existing tests for new data structure

Behavior

// Set solid to red
updatePreference('type', 'solid')
updatePreference('color', '#FF0000')

// Set gradient to blue→green
updatePreference('type', 'gradient')
updatePreference('color', '#0000FF')
updatePreference('secondaryColor', '#00FF00')

// Switch back
updatePreference('type', 'solid')
// Color is still #FF0000 (not #0000FF)
Original prompt

This section details on the original issue you should resolve

<issue_title>feat: More granular settings</issue_title>
<issue_description># Feature Request

Describe the Feature Request

I'd like all the different settings for the background to be individual, rather than share the colors between them.

Describe Preferred Solution

If i change the color in the gradient, it should not affect the solid color view.
</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Added typeColors field to store colors per background type
- Updated useBackgroundPreferences to manage per-type colors
- Modified BackgroundSettings UI to use per-type colors
- Added migration logic for backward compatibility
- Added tests to verify color independence between types

Co-authored-by: ullbergm <273876+ullbergm@users.noreply.github.com>
@github-actions github-actions Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. area/frontend Changes made to the frontend and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 6, 2025
Copilot AI and others added 2 commits November 6, 2025 12:58
- Fix fallback reference to use typeColors.gradient.color
- Only update gradient-specific properties when type is gradient
- Make gradient value computation conditional on type

Co-authored-by: ullbergm <273876+ullbergm@users.noreply.github.com>
Use typeColors values from DEFAULT_PREFERENCES for consistency

Co-authored-by: ullbergm <273876+ullbergm@users.noreply.github.com>
Copilot AI changed the title [WIP] Add more granular settings for background colors feat: Independent color settings per background type Nov 6, 2025
Copilot AI requested a review from ullbergm November 6, 2025 13:06
@github-actions github-actions Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 6, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 6, 2025

Test Results - JVM

946 tests   938 ✅  1m 7s ⏱️
 76 suites    8 💤
 49 files      0 ❌

Results for commit 9808f0e.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 6, 2025

Test Results - Native

946 tests   938 ✅  1m 8s ⏱️
 76 suites    8 💤
 49 files      0 ❌

Results for commit 9808f0e.

@ullbergm ullbergm marked this pull request as ready for review November 6, 2025 23:15
@ullbergm ullbergm merged commit f2162ca into main Nov 6, 2025
12 checks passed
@ullbergm ullbergm deleted the copilot/add-more-granular-settings branch November 6, 2025 23:15
@ullbergm ullbergm restored the copilot/add-more-granular-settings branch November 6, 2025 23:17
@github-actions
Copy link
Copy Markdown
Contributor

Pull Request closed and locked due to lack of activity.
If you'd like to build on this closed PR, you can clone it using this method: https://stackoverflow.com/a/14969986
Then open a new PR, referencing this closed PR in your message.

@github-actions github-actions Bot locked and limited conversation to collaborators Nov 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area/frontend Changes made to the frontend size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: More granular settings

2 participants