Skip to content

feat(notification): add notification accent colors - #172

Merged
matejdro merged 1 commit into
matejdro:mainfrom
legop3:feat/notification-color-banners
Sep 15, 2026
Merged

matejdro merged 1 commit into
matejdro:mainfrom
legop3:feat/notification-color-banners

Conversation

@legop3

@legop3 legop3 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Closes #8

Adds colored banners to the top of notification windows using Android notification accent colors provided by apps. Visual behavior is only changed for watches with color displays.

  • Reads Notification.color from android
  • Sends the color through the sync protocol
  • Chooses a text color for the title and subtitle to be overtop of the colored banner using gcolor_legible_over() from the pebble SDK
  • Draws the colored rectangle "banner" behind the text and icon
  • Notifications with no color keep the existing appearance
  • Protocol changes are documented
  • Protocol versions are bumped because the transmitted data has changed
  • Updated tests:
    • NotificationParserTest.parseNotificationWithASimpleText() (added Notification.color to verify parsing)
    • WatchSyncerImplTest.Sync a notification (added an example color to verify serialization)

Tested and working with the android app and watch app together, built from the code in this branch. This addition is pretty simple, basically just pulling the notification color from android and passing it through to the watch. One thing however that is imperfect, is that the app icon has a white background, and I believe that it's generated in the phone this way, so it cannot be fixed without more invasive modifications on the android side, which I am not super sure about, though a fix for this to just make the image transparent if possible would be extremely helpful!

Please let me know if anything needs to be changed, thank you!!

iconDrawable = notification.smallIcon?.loadDrawable(context),
largeImage = largeImage
largeImage = largeImage,
color = notification.color,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do notifications set this field often? If I remember correctly from the NC1 days, most notifications did not have this field?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! At least in my experience, on stock android the little notification icon adopts this color unless there's an image icon to replace it with. Been running this PR for a few days and so far telegram, gmail, discord, snapchat, it all works.

Comment thread protocol.md Outdated
* Title font (uint8)
* Subtitle font (uint8)
* Body font (uint8)
* Notification accent color (uint32, ARGB), present only when bucket flag 0x08 is set

@matejdro matejdro Aug 26, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason why this needs to be 32-bit? Pebble's color is 8-bit.

if (window_notification_data.color != 0)
{
const uint32_t color = window_notification_data.color;
const GColor banner_color = GColorFromRGB(

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another reason for using 8-bit instead of 32-bit color, we can create it simply like this:

GColor banner_color = (GColor8) {.argb = window_notification_data.color};

color & 0xff
);

graphics_context_set_fill_color(ctx, banner_color);

@matejdro matejdro Aug 26, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just fills the entire screen with the color? Not sure I like this that much, it's pretty jarring.

Maybe a good alternative would be just coloring the statusbar, like the NC1 did it?

@legop3 legop3 Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may honestly, drawing the color before the notification content? Either way it does create a colored banner title bar, this is what I landed on after messing with it for a while, I'm not very experienced in this level of programming.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you take a picture of a notification with a color?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, here you go:
20260830_150922

@matejdro matejdro Aug 31, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that actually looks much better than I expected. No changes needed.

Although a separate request: could you try also making the icon transparent? If not, it's also fine, I can do it after merging.

Comment thread protocol.md Outdated
* 0x01 - When set, notification was not seen by the user yet
* 0x02 - When set, notification has a pause enabled
* 0x04 - When set and this notification is present, app should do periodic vibration
* 0x08 - When set, the bucket contains a notification accent color

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I like this flag idea, it seems to add complexity for not much good reason. Maybe if the alpha of the color is set to 0, we can treat it as if the color not present? With the 8-bit color, it would only waste 1 byte on non-colored notifications, which is not that much.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good points, I'll look into the 8 bit colors and get rid of this flag.

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Overall Project 85.35% 🍏

There is no coverage information present for the Files changed

@legop3
legop3 force-pushed the feat/notification-color-banners branch from ea49328 to 1150ef8 Compare September 5, 2026 03:10
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Lint report

Results

Suppressed Results

Nothing here.

BREAKING CHANGE: bump the notification sync protocol from version 8 to 9 to transmit notification accent colors.
@legop3
legop3 force-pushed the feat/notification-color-banners branch from 2201371 to 05aea6b Compare September 11, 2026 20:24
@legop3

legop3 commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

okay, i switched to the 8 bit color and removed the flag. the color is now 0 if there is no color. the android app converts the color from the 32 bit color that android provides to 8 bit color. I was not able to figure out how to make the icon work right, it would have to be transparent and choose it's (black or white) color based on the banner color.

@matejdro
matejdro merged commit 4ddc8a6 into matejdro:main Sep 15, 2026
2 checks passed
@matejdro

Copy link
Copy Markdown
Owner

Thanks!

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.

Color icons/"banners" per app

2 participants