Skip to content

feat(appearance): add stroke and background color customization with app-adaptive and event-adaptive support - #33

Merged
EvanKoe merged 4 commits into
EvanKoe:devfrom
anuragdeshpande:feat/app-adaptive-color
Aug 25, 2026
Merged

feat(appearance): add stroke and background color customization with app-adaptive and event-adaptive support#33
EvanKoe merged 4 commits into
EvanKoe:devfrom
anuragdeshpande:feat/app-adaptive-color

Conversation

@anuragdeshpande

Copy link
Copy Markdown

Resolves #22 (#22)

Summary

This PR adds comprehensive stroke and background color customization for the Dynamic Island in both collapsed (Normal) and Expanded states, including App-Adaptive color extraction for notifications and full Event-Adaptive color support for system events (Wi-Fi, Charging, Lock/Unlock, Battery, etc.).


What Was Done

1. Stroke Outline Customization

  • Added an outline/stroke toggle for the island with adjustable Stroke width (1–8 dp) and Stroke opacity (0–100%).
  • Added Stroke colour selection with presets, custom color picker, Material You dynamic theme roles, and App Icon Adaptive Colour.
  • For App Icon adaptive color, added Non-app event fallback strategies:
    • Adaptive: Uses the active event's primary accent or media art color.
    • Material You: Uses the system dynamic theme accent.
    • OLED Black: Uses pure black (#000000).

2. Collapsed & Expanded Background Customization

  • Dedicated background fill configurations for Normal (collapsed) and Expanded states with smooth cross-fade animation during expansion/collapse.
  • Three background modes:
    • Solid: Flat fill supporting fixed colors, Material You dynamic roles, OLED black, and App Icon adaptive color.
    • Gradient: Two-stop gradient with selectable direction (Horizontal, Vertical, Diagonal), start/end colors, and opacity.
    • App Fade: Directional fade (Left to right / Right to left) from the notifying app/event primary branding color into a base color (e.g. OLED black), with adjustable solid percentage, fade distance, and opacity.

3. Custom System Events Support (Wi-Fi, Charging, Lock/Unlock, etc.)

  • Added unified primary color resolution for all events via IslandEvent.primaryColor().
  • Primary color resolution follows a consistent hierarchy:
    1. Per-event user color override (colorOverride)
    2. Material You dynamic color when Dynamic color for all events (useThemeColor) is enabled
    3. Extracted app launcher icon color (appColor) for notifications
    4. Built-in event default accent (accent) for system events (Wi-Fi, USB, Charging, Battery, Headphones, etc.)
  • Stroke and background configurations (including App Fade and App Icon adaptive stroke/background) are now applied to system events just like notifications, deriving the color from the event's primary color or dynamic theme.

4. Unit Testing & Verification

  • Added JVM unit tests in CutoutColorsTest verifying color resolution for system events, color overrides, dynamic themes, app notifications, and empty/idle fallbacks.

Screenshots

Appearance & Stroke Settings Background (Normal State)
Appearance Stroke Background Normal
Background (Expanded State) Background App Fade Settings
Background Expanded Background App Fade

Technical Details

  • AppIconColorExtractor: Extracts dominant/vibrant branding color from the application's default launcher icon with fallback.
  • AppearancePreferences: Stores stroke settings and serialized CutoutFill (Solid, Gradient, AppFade) and CutoutColor preferences via DataStore.
  • CutoutColors: Color resolver supporting opacity, dynamic Material You roles, fallback strategies, and IslandEvent.primaryColor().
  • DynamicIsland & IslandSurface: Renders stroke border and interpolates background brushes and base colors between normal and expanded states.
  • BackgroundScreen & AppearanceScreen: Settings UI with preview integration, sliders, and fallback selection.

@anuragdeshpande anuragdeshpande mentioned this pull request Aug 24, 2026
@EvanKoe EvanKoe assigned EvanKoe and anuragdeshpande and unassigned EvanKoe Aug 24, 2026
@EvanKoe

EvanKoe commented Aug 24, 2026

Copy link
Copy Markdown
Owner

It is a very cool feature, thanks for the PR. I am just wondering why the Appearance > Background color > App Fade is not integrated into the Appearance > Background color > Gradient, as both are gradients. Would that be possible for you?

Also, I love the stroke adaptive color feature, that is very nice, I might also use it myself! I still haven't figured out what does the "Non-app event fallback" do in Appearance > Stroke colour.

Also, you are trying to merge on main, not on dev. Maybe it's a settings on my end to force people to merge on dev, do you have any idea?

@EvanKoe
EvanKoe changed the base branch from main to dev August 24, 2026 07:37
@EvanKoe

EvanKoe commented Aug 24, 2026

Copy link
Copy Markdown
Owner

The dev branch had a small refactor concerning colors, so it created conflicts. Now all the color logic moved to data/CutoutColor.kt instead of AppearanceSettings.kt. Can you rebase on dev and resolve the conflicts so I can merge your PR ? @anuragdeshpande

@anuragdeshpande
anuragdeshpande force-pushed the feat/app-adaptive-color branch from f018806 to 2e2f5b0 Compare August 24, 2026 14:39
@anuragdeshpande

Copy link
Copy Markdown
Author

Rebased onto dev and addressed your feedback:

  1. Merged App Fade into Gradient: Consolidated background gradient logic so "App icon" can be picked as a color choice for gradient stops (with automatic migration for existing configurations), avoiding duplicate gradient management.
  2. Customizable Text Colour: Added a text color picker with auto-contrast fallback so text remains legible across custom background fills/gradients.
  3. Clarified Fallback Label & Description: Renamed "Non-app event fallback" to "Fallback colour" with an explanatory description ("Used when no app icon is available (such as system events or an idle island)").
  4. Resolved Conflicts: Rebased cleanly on dev with the latest CutoutColor.kt architecture. All unit tests pass!

@EvanKoe

EvanKoe commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Lgtm, might be a good idea (for later) to implement color animations (fade in-out) when adaptive color is on. Merging

@EvanKoe
EvanKoe merged commit 3a11d03 into EvanKoe:dev Aug 25, 2026
1 check passed
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.

Automatic color

2 participants