Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2c8e770 authored by Jeff DeCew's avatar Jeff DeCew Committed by Ibrahim Yilmaz
Browse files

[RONs] Update notification colors

The OS will generate a simple palette for colored notifications based on the provided color.

The primary and secondary surfaces will be blended with a new "surface extreme" color at 90% and 80% opacity, respectively.

The surface extreme color will be black when the provided color is not dark. Otherwise, it will be white.

Bug: 369149914
Test: visual test, screenshot tests to come later
Flag: android.app.ui_rich_ongoing

Change-Id: Ie7bc9ab99d4cce82c6643036dec85d2d82e8234f
parent 296b69bc
Loading
Loading
Loading
Loading
+17 −6
Original line number Diff line number Diff line
@@ -14779,12 +14779,23 @@ public class Notification implements Parcelable
                } else {
                    mBackgroundColor = rawColor;
                }
                if (Flags.uiRichOngoing()) {
                    boolean isBgDark = Notification.Builder.isColorDark(mBackgroundColor);
                    int onSurfaceColorExtreme = isBgDark ? Color.WHITE : Color.BLACK;
                    mPrimaryTextColor = ContrastColorUtil.ensureContrast(
                            ColorUtils.blendARGB(mBackgroundColor, onSurfaceColorExtreme, 0.9f),
                            mBackgroundColor, isBgDark, 4.5);
                    mSecondaryTextColor = ContrastColorUtil.ensureContrast(
                            ColorUtils.blendARGB(mBackgroundColor, onSurfaceColorExtreme, 0.8f),
                            mBackgroundColor, isBgDark, 4.5);
                } else {
                    mPrimaryTextColor = ContrastColorUtil.findAlphaToMeetContrast(
                            ContrastColorUtil.resolvePrimaryColor(ctx, mBackgroundColor, nightMode),
                            mBackgroundColor, 4.5);
                    mSecondaryTextColor = ContrastColorUtil.findAlphaToMeetContrast(
                        ContrastColorUtil.resolveSecondaryColor(ctx, mBackgroundColor, nightMode),
                        mBackgroundColor, 4.5);
                            ContrastColorUtil.resolveSecondaryColor(ctx,
                                    mBackgroundColor, nightMode), mBackgroundColor, 4.5);
                }
                mContrastColor = mPrimaryTextColor;
                mPrimaryAccentColor = mPrimaryTextColor;
                mSecondaryAccentColor = mSecondaryTextColor;