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

Commit 4dcacd37 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Single color scrim

Removed gradient and kept brightest color.

Test: atest ./tests/Internal/src/com/android/internal/colorextraction/types/TonalTest.java
Test: visual
Bug: 64122537
Change-Id: I75cba32172a5869f3d8a57ab9955bffcba60db76
parent c9cbc3e5
Loading
Loading
Loading
Loading
+10 −15
Original line number Original line Diff line number Diff line
@@ -53,10 +53,8 @@ public class Tonal implements ExtractionType {


    public static final int THRESHOLD_COLOR_LIGHT = 0xffe0e0e0;
    public static final int THRESHOLD_COLOR_LIGHT = 0xffe0e0e0;
    public static final int MAIN_COLOR_LIGHT = 0xffe0e0e0;
    public static final int MAIN_COLOR_LIGHT = 0xffe0e0e0;
    public static final int SECONDARY_COLOR_LIGHT = 0xff9e9e9e;
    public static final int THRESHOLD_COLOR_DARK = 0xff212121;
    public static final int THRESHOLD_COLOR_DARK = 0xff212121;
    public static final int MAIN_COLOR_DARK = 0xff000000;
    public static final int MAIN_COLOR_DARK = 0xff000000;
    public static final int SECONDARY_COLOR_DARK = 0xff000000;


    private final TonalPalette mGreyPalette;
    private final TonalPalette mGreyPalette;
    private final ArrayList<TonalPalette> mTonalPalettes;
    private final ArrayList<TonalPalette> mTonalPalettes;
@@ -211,10 +209,8 @@ public class Tonal implements ExtractionType {
        }
        }


        // Normal colors:
        // Normal colors:
        // best fit + a 2 colors offset
        outColorsNormal.setMainColor(mainColor);
        outColorsNormal.setMainColor(mainColor);
        int secondaryIndex = primaryIndex + (primaryIndex >= 2 ? -2 : 2);
        outColorsNormal.setSecondaryColor(mainColor);
        outColorsNormal.setSecondaryColor(getColorInt(secondaryIndex, h, s, l));


        // Dark colors:
        // Dark colors:
        // Stops at 4th color, only lighter if dark text is supported
        // Stops at 4th color, only lighter if dark text is supported
@@ -225,9 +221,9 @@ public class Tonal implements ExtractionType {
        } else {
        } else {
            primaryIndex = Math.min(fitIndex, 3);
            primaryIndex = Math.min(fitIndex, 3);
        }
        }
        secondaryIndex = primaryIndex + (primaryIndex >= 2 ? -2 : 2);
        mainColor = getColorInt(primaryIndex, h, s, l);
        outColorsDark.setMainColor(getColorInt(primaryIndex, h, s, l));
        outColorsDark.setMainColor(mainColor);
        outColorsDark.setSecondaryColor(getColorInt(secondaryIndex, h, s, l));
        outColorsDark.setSecondaryColor(mainColor);


        // Extra Dark:
        // Extra Dark:
        // Stay close to dark colors until dark text is supported
        // Stay close to dark colors until dark text is supported
@@ -238,9 +234,9 @@ public class Tonal implements ExtractionType {
        } else {
        } else {
            primaryIndex = 2;
            primaryIndex = 2;
        }
        }
        secondaryIndex = primaryIndex + (primaryIndex >= 2 ? -2 : 2);
        mainColor = getColorInt(primaryIndex, h, s, l);
        outColorsExtraDark.setMainColor(getColorInt(primaryIndex, h, s, l));
        outColorsExtraDark.setMainColor(mainColor);
        outColorsExtraDark.setSecondaryColor(getColorInt(secondaryIndex, h, s, l));
        outColorsExtraDark.setSecondaryColor(mainColor);


        outColorsNormal.setSupportsDarkText(supportsDarkText);
        outColorsNormal.setSupportsDarkText(supportsDarkText);
        outColorsDark.setSupportsDarkText(supportsDarkText);
        outColorsDark.setSupportsDarkText(supportsDarkText);
@@ -273,11 +269,10 @@ public class Tonal implements ExtractionType {
        boolean light = inWallpaperColors != null
        boolean light = inWallpaperColors != null
                && (inWallpaperColors.getColorHints() & WallpaperColors.HINT_SUPPORTS_DARK_TEXT)
                && (inWallpaperColors.getColorHints() & WallpaperColors.HINT_SUPPORTS_DARK_TEXT)
                != 0;
                != 0;
        int innerColor = light ? MAIN_COLOR_LIGHT : MAIN_COLOR_DARK;
        final int color = light ? MAIN_COLOR_LIGHT : MAIN_COLOR_DARK;
        int outerColor = light ? SECONDARY_COLOR_LIGHT : SECONDARY_COLOR_DARK;


        outGradientColors.setMainColor(innerColor);
        outGradientColors.setMainColor(color);
        outGradientColors.setSecondaryColor(outerColor);
        outGradientColors.setSecondaryColor(color);
        outGradientColors.setSupportsDarkText(light);
        outGradientColors.setSupportsDarkText(light);
    }
    }