Add key color roles, rename surfaces, adjust spec.
Done per chat and commentary on ag/21127519. - Key colors are a new concept. A key color for a palette is found by taking the palette's hue and chroma, and searching for the first tone from T50 that reaches that chroma. Colors made using relativeLstar in XML will now reach spec. - Surface names changed after the code landed in the internal source repo. This CL updates their names. - Monet Gallery matches Android 2021's output. libmonet Java did not match. Double-checked that Monet Gallery matched Android, updated variant specs to match. Bug: 266731167 Test: atest com.android.systemui.monet, all 389 pass. Change-Id: I09a8ec9bd8883d124804db31369c595a6aca6a1b
This commit is contained in:
@@ -57,19 +57,19 @@ public final class MaterialDynamicColors {
|
||||
public static final DynamicColor surfaceDim =
|
||||
DynamicColor.fromPalette((s) -> s.neutralPalette, (s) -> s.isDark ? 6.0 : 87.0);
|
||||
|
||||
public static final DynamicColor surfaceSub2 =
|
||||
public static final DynamicColor surfaceContainerLowest =
|
||||
DynamicColor.fromPalette((s) -> s.neutralPalette, (s) -> s.isDark ? 4.0 : 100.0);
|
||||
|
||||
public static final DynamicColor surfaceSub1 =
|
||||
public static final DynamicColor surfaceContainerLow =
|
||||
DynamicColor.fromPalette((s) -> s.neutralPalette, (s) -> s.isDark ? 10.0 : 96.0);
|
||||
|
||||
public static final DynamicColor surfaceContainer =
|
||||
DynamicColor.fromPalette((s) -> s.neutralPalette, (s) -> s.isDark ? 12.0 : 94.0);
|
||||
|
||||
public static final DynamicColor surfaceAdd1 =
|
||||
public static final DynamicColor surfaceContainerHigh =
|
||||
DynamicColor.fromPalette((s) -> s.neutralPalette, (s) -> s.isDark ? 17.0 : 92.0);
|
||||
|
||||
public static final DynamicColor surfaceAdd2 =
|
||||
public static final DynamicColor surfaceContainerHighest =
|
||||
DynamicColor.fromPalette((s) -> s.neutralPalette, (s) -> s.isDark ? 22.0 : 90.0);
|
||||
|
||||
public static final DynamicColor onSurface =
|
||||
@@ -366,6 +366,27 @@ public final class MaterialDynamicColors {
|
||||
public static final DynamicColor textHintInverse =
|
||||
DynamicColor.fromPalette((s) -> s.neutralPalette, (s) -> s.isDark ? 10.0 : 90.0);
|
||||
|
||||
public static final DynamicColor primaryPaletteKeyColor =
|
||||
DynamicColor.fromPalette(
|
||||
(s) -> s.primaryPalette, (s) -> s.primaryPalette.getKeyColor().getTone());
|
||||
|
||||
public static final DynamicColor secondaryPaletteKeyColor =
|
||||
DynamicColor.fromPalette(
|
||||
(s) -> s.secondaryPalette, (s) -> s.secondaryPalette.getKeyColor().getTone());
|
||||
|
||||
public static final DynamicColor tertiaryPaletteKeyColor =
|
||||
DynamicColor.fromPalette(
|
||||
(s) -> s.tertiaryPalette, (s) -> s.tertiaryPalette.getKeyColor().getTone());
|
||||
|
||||
public static final DynamicColor neutralPaletteKeyColor =
|
||||
DynamicColor.fromPalette(
|
||||
(s) -> s.neutralPalette, (s) -> s.neutralPalette.getKeyColor().getTone());
|
||||
|
||||
public static final DynamicColor neutralVariantPaletteKeyColor =
|
||||
DynamicColor.fromPalette(
|
||||
(s) -> s.neutralVariantPalette,
|
||||
(s) -> s.neutralVariantPalette.getKeyColor().getTone());
|
||||
|
||||
private static ViewingConditions viewingConditionsForAlbers(DynamicScheme scheme) {
|
||||
return ViewingConditions.defaultWithBackgroundLstar(scheme.isDark ? 30.0 : 80.0);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.Map;
|
||||
*/
|
||||
public final class TonalPalette {
|
||||
Map<Integer, Integer> cache;
|
||||
Hct keyColor;
|
||||
double hue;
|
||||
double chroma;
|
||||
|
||||
@@ -46,7 +47,7 @@ public final class TonalPalette {
|
||||
* @return Tones matching that color's hue and chroma.
|
||||
*/
|
||||
public static TonalPalette fromHct(Hct hct) {
|
||||
return TonalPalette.fromHueAndChroma(hct.getHue(), hct.getChroma());
|
||||
return new TonalPalette(hct.getHue(), hct.getChroma(), hct);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,13 +58,52 @@ public final class TonalPalette {
|
||||
* @return Tones matching hue and chroma.
|
||||
*/
|
||||
public static TonalPalette fromHueAndChroma(double hue, double chroma) {
|
||||
return new TonalPalette(hue, chroma);
|
||||
return new TonalPalette(hue, chroma, createKeyColor(hue, chroma));
|
||||
}
|
||||
|
||||
private TonalPalette(double hue, double chroma) {
|
||||
private TonalPalette(double hue, double chroma, Hct keyColor) {
|
||||
cache = new HashMap<>();
|
||||
this.hue = hue;
|
||||
this.chroma = chroma;
|
||||
this.keyColor = keyColor;
|
||||
}
|
||||
|
||||
/** The key color is the first tone, starting from T50, matching the given hue and chroma. */
|
||||
private static Hct createKeyColor(double hue, double chroma) {
|
||||
double startTone = 50.0;
|
||||
Hct smallestDeltaHct = Hct.from(hue, chroma, startTone);
|
||||
double smallestDelta = Math.abs(smallestDeltaHct.getChroma() - chroma);
|
||||
// Starting from T50, check T+/-delta to see if they match the requested
|
||||
// chroma.
|
||||
//
|
||||
// Starts from T50 because T50 has the most chroma available, on
|
||||
// average. Thus it is most likely to have a direct answer and minimize
|
||||
// iteration.
|
||||
for (double delta = 1.0; delta < 50.0; delta += 1.0) {
|
||||
// Termination condition rounding instead of minimizing delta to avoid
|
||||
// case where requested chroma is 16.51, and the closest chroma is 16.49.
|
||||
// Error is minimized, but when rounded and displayed, requested chroma
|
||||
// is 17, key color's chroma is 16.
|
||||
if (Math.round(chroma) == Math.round(smallestDeltaHct.getChroma())) {
|
||||
return smallestDeltaHct;
|
||||
}
|
||||
|
||||
final Hct hctAdd = Hct.from(hue, chroma, startTone + delta);
|
||||
final double hctAddDelta = Math.abs(hctAdd.getChroma() - chroma);
|
||||
if (hctAddDelta < smallestDelta) {
|
||||
smallestDelta = hctAddDelta;
|
||||
smallestDeltaHct = hctAdd;
|
||||
}
|
||||
|
||||
final Hct hctSubtract = Hct.from(hue, chroma, startTone - delta);
|
||||
final double hctSubtractDelta = Math.abs(hctSubtract.getChroma() - chroma);
|
||||
if (hctSubtractDelta < smallestDelta) {
|
||||
smallestDelta = hctSubtractDelta;
|
||||
smallestDeltaHct = hctSubtract;
|
||||
}
|
||||
}
|
||||
|
||||
return smallestDeltaHct;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,4 +138,9 @@ public final class TonalPalette {
|
||||
public double getHue() {
|
||||
return this.hue;
|
||||
}
|
||||
|
||||
/** The key color is the first tone, starting from T50, that matches the palette's chroma. */
|
||||
public Hct getKeyColor() {
|
||||
return this.keyColor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,14 +34,16 @@ public class SchemeExpressive extends DynamicScheme {
|
||||
isDark,
|
||||
contrastLevel,
|
||||
TonalPalette.fromHueAndChroma(
|
||||
MathUtils.sanitizeDegreesDouble(sourceColorHct.getHue() + 120.0), 40.0),
|
||||
MathUtils.sanitizeDegreesDouble(sourceColorHct.getHue() + 240.0), 40.0),
|
||||
TonalPalette.fromHueAndChroma(
|
||||
DynamicScheme.getRotatedHue(sourceColorHct, HUES, SECONDARY_ROTATIONS),
|
||||
24.0),
|
||||
TonalPalette.fromHueAndChroma(
|
||||
DynamicScheme.getRotatedHue(sourceColorHct, HUES, TERTIARY_ROTATIONS),
|
||||
32.0),
|
||||
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 8.0),
|
||||
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 12.0));
|
||||
TonalPalette.fromHueAndChroma(
|
||||
MathUtils.sanitizeDegreesDouble(sourceColorHct.getHue() + 15.0), 8.0),
|
||||
TonalPalette.fromHueAndChroma(
|
||||
MathUtils.sanitizeDegreesDouble(sourceColorHct.getHue() + 15.0), 12.0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@ public class SchemeTonalSpot extends DynamicScheme {
|
||||
Variant.TONAL_SPOT,
|
||||
isDark,
|
||||
contrastLevel,
|
||||
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 40.0),
|
||||
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 36.0),
|
||||
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 16.0),
|
||||
TonalPalette.fromHueAndChroma(
|
||||
MathUtils.sanitizeDegreesDouble(sourceColorHct.getHue() + 60.0), 24.0),
|
||||
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 6.0),
|
||||
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 4.0),
|
||||
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 8.0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class SchemeVibrant extends DynamicScheme {
|
||||
TonalPalette.fromHueAndChroma(
|
||||
DynamicScheme.getRotatedHue(sourceColorHct, HUES, TERTIARY_ROTATIONS),
|
||||
32.0),
|
||||
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 8.0),
|
||||
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 10.0),
|
||||
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 12.0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,22 @@ import org.junit.runners.JUnit4;
|
||||
@RunWith(JUnit4.class)
|
||||
public final class SchemeContentTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void testKeyColors() {
|
||||
SchemeContent scheme = new SchemeContent(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
|
||||
assertThat(MaterialDynamicColors.primaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff080CFF);
|
||||
assertThat(MaterialDynamicColors.secondaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff656DD3);
|
||||
assertThat(MaterialDynamicColors.tertiaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff81009F);
|
||||
assertThat(MaterialDynamicColors.neutralPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff767684);
|
||||
assertThat(MaterialDynamicColors.neutralVariantPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff757589);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_minContrast_primary() {
|
||||
SchemeContent scheme = new SchemeContent(Hct.fromInt(0xFF0000ff), false, -1.0);
|
||||
|
||||
@@ -33,159 +33,175 @@ import org.junit.runners.JUnit4;
|
||||
@RunWith(JUnit4.class)
|
||||
public final class SchemeExpressiveTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void testKeyColors() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
|
||||
assertThat(MaterialDynamicColors.primaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff35855F);
|
||||
assertThat(MaterialDynamicColors.secondaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff8C6D8C);
|
||||
assertThat(MaterialDynamicColors.tertiaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff806EA1);
|
||||
assertThat(MaterialDynamicColors.neutralPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff79757F);
|
||||
assertThat(MaterialDynamicColors.neutralVariantPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff7A7585);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_minContrast_primary() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), false, -1.0);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xffad603c);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xff32835D);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_standardContrast_primary() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xff924b28);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xff146C48);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_maxContrast_primary() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), false, 1.0);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xff401400);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xff002818);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_minContrast_primaryContainer() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), false, -1.0);
|
||||
assertThat(MaterialDynamicColors.primaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xffffdbcc);
|
||||
0xffA2F4C6);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_standardContrast_primaryContainer() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
assertThat(MaterialDynamicColors.primaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xffffdbcc);
|
||||
0xffA2F4C6);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_maxContrast_primaryContainer() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), false, 1.0);
|
||||
assertThat(MaterialDynamicColors.primaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xff6f3010);
|
||||
0xff004D31);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_minContrast_onPrimaryContainer() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), false, -1.0);
|
||||
assertThat(MaterialDynamicColors.onPrimaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xff99512e);
|
||||
0xff1e724e);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_standardContrast_onPrimaryContainer() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
assertThat(MaterialDynamicColors.onPrimaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xff351000);
|
||||
0xff002112);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_maxContrast_onPrimaryContainer() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), false, 1.0);
|
||||
assertThat(MaterialDynamicColors.onPrimaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xffffd0bc);
|
||||
0xff9aebbe);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_minContrast_surface() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), false, -1.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xfffbf8ff);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xfffdf7ff);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_standardContrast_surface() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xfffbf8ff);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xfffdf7ff);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_maxContrast_surface() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), false, 1.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xfffbf8ff);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xfffdf7ff);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_minContrast_primary() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), true, -1.0);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xffad603c);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xff32835d);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_standardContrast_primary() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), true, 0.0);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xffffb595);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xff87d7ab);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_maxContrast_primary() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), true, 1.0);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xfffff3ee);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xffd5ffe4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_minContrast_primaryContainer() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), true, -1.0);
|
||||
assertThat(MaterialDynamicColors.primaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xff743413);
|
||||
0xff005234);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_standardContrast_primaryContainer() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), true, 0.0);
|
||||
assertThat(MaterialDynamicColors.primaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xff743413);
|
||||
0xff005234);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_maxContrast_primaryContainer() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), true, 1.0);
|
||||
assertThat(MaterialDynamicColors.primaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xffffbb9e);
|
||||
0xff8bdbaf);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_minContrast_onPrimaryContainer() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), true, -1.0);
|
||||
assertThat(MaterialDynamicColors.onPrimaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xfff99f75);
|
||||
0xff76c59b);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_standardContrast_onPrimaryContainer() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), true, 0.0);
|
||||
assertThat(MaterialDynamicColors.onPrimaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xffffdbcc);
|
||||
0xffa2f4c6);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_maxContrast_onPrimaryContainer() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), true, 1.0);
|
||||
assertThat(MaterialDynamicColors.onPrimaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xff622706);
|
||||
0xff004229);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_minContrast_surface() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), true, -1.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff12131a);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff14121a);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_standardContrast_surface() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), true, 0.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff12131a);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff14121a);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_maxContrast_surface() {
|
||||
SchemeExpressive scheme = new SchemeExpressive(Hct.fromInt(0xff0000ff), true, 1.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff12131a);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff14121a);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,21 @@ import org.junit.runners.JUnit4;
|
||||
@SmallTest
|
||||
@RunWith(JUnit4.class)
|
||||
public final class SchemeFidelityTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void testKeyColors() {
|
||||
SchemeFidelity scheme = new SchemeFidelity(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
|
||||
assertThat(MaterialDynamicColors.primaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff080CFF);
|
||||
assertThat(MaterialDynamicColors.secondaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff656DD3);
|
||||
assertThat(MaterialDynamicColors.tertiaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff9D0002);
|
||||
assertThat(MaterialDynamicColors.neutralPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff767684);
|
||||
assertThat(MaterialDynamicColors.neutralVariantPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff757589);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_minContrast_primary() {
|
||||
@@ -251,5 +266,4 @@ public final class SchemeFidelityTest extends SysuiTestCase {
|
||||
SchemeFidelity scheme = new SchemeFidelity(Hct.fromInt(0xff0000ff), true, 1.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff12121d);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,22 @@ import org.junit.runners.JUnit4;
|
||||
@RunWith(JUnit4.class)
|
||||
public final class SchemeFruitSaladTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void testKeyColors() {
|
||||
SchemeFruitSalad scheme = new SchemeFruitSalad(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
|
||||
assertThat(MaterialDynamicColors.primaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff0091C0);
|
||||
assertThat(MaterialDynamicColors.secondaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff3A7E9E);
|
||||
assertThat(MaterialDynamicColors.tertiaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff6E72AC);
|
||||
assertThat(MaterialDynamicColors.neutralPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff777682);
|
||||
assertThat(MaterialDynamicColors.neutralVariantPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff75758B);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_minContrast_primary() {
|
||||
SchemeFruitSalad scheme = new SchemeFruitSalad(Hct.fromInt(0xff0000ff), false, -1.0);
|
||||
|
||||
@@ -33,6 +33,22 @@ import org.junit.runners.JUnit4;
|
||||
@RunWith(JUnit4.class)
|
||||
public final class SchemeMonochromeTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void testKeyColors() {
|
||||
SchemeMonochrome scheme = new SchemeMonochrome(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
|
||||
assertThat(MaterialDynamicColors.primaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff070707);
|
||||
assertThat(MaterialDynamicColors.secondaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff070707);
|
||||
assertThat(MaterialDynamicColors.tertiaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff070707);
|
||||
assertThat(MaterialDynamicColors.neutralPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff070707);
|
||||
assertThat(MaterialDynamicColors.neutralVariantPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff070707);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_minContrast_primary() {
|
||||
SchemeMonochrome scheme = new SchemeMonochrome(Hct.fromInt(0xff0000ff), false, -1.0);
|
||||
|
||||
@@ -33,6 +33,22 @@ import org.junit.runners.JUnit4;
|
||||
@RunWith(JUnit4.class)
|
||||
public final class SchemeNeutralTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void testKeyColors() {
|
||||
SchemeNeutral scheme = new SchemeNeutral(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
|
||||
assertThat(MaterialDynamicColors.primaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff767685);
|
||||
assertThat(MaterialDynamicColors.secondaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff777680);
|
||||
assertThat(MaterialDynamicColors.tertiaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff75758B);
|
||||
assertThat(MaterialDynamicColors.neutralPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff787678);
|
||||
assertThat(MaterialDynamicColors.neutralVariantPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff787678);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_minContrast_primary() {
|
||||
SchemeNeutral scheme = new SchemeNeutral(Hct.fromInt(0xff0000ff), false, -1.0);
|
||||
|
||||
@@ -33,6 +33,22 @@ import org.junit.runners.JUnit4;
|
||||
@RunWith(JUnit4.class)
|
||||
public final class SchemeRainbowTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void testKeyColors() {
|
||||
SchemeRainbow scheme = new SchemeRainbow(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
|
||||
assertThat(MaterialDynamicColors.primaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff696FC4);
|
||||
assertThat(MaterialDynamicColors.secondaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff75758B);
|
||||
assertThat(MaterialDynamicColors.tertiaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff936B84);
|
||||
assertThat(MaterialDynamicColors.neutralPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff070707);
|
||||
assertThat(MaterialDynamicColors.neutralVariantPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff070707);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_minContrast_primary() {
|
||||
SchemeRainbow scheme = new SchemeRainbow(Hct.fromInt(0xff0000ff), false, -1.0);
|
||||
@@ -230,5 +246,4 @@ public final class SchemeRainbowTest extends SysuiTestCase {
|
||||
SchemeRainbow scheme = new SchemeRainbow(Hct.fromInt(0xff0000ff), true, 1.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff131313);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,22 +33,38 @@ import org.junit.runners.JUnit4;
|
||||
@RunWith(JUnit4.class)
|
||||
public final class SchemeTonalSpotTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void testKeyColors() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
|
||||
assertThat(MaterialDynamicColors.primaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff6E72AC);
|
||||
assertThat(MaterialDynamicColors.secondaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff75758B);
|
||||
assertThat(MaterialDynamicColors.tertiaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff936B84);
|
||||
assertThat(MaterialDynamicColors.neutralPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff78767A);
|
||||
assertThat(MaterialDynamicColors.neutralVariantPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff777680);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_minContrast_primary() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), false, -1.0);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xff6a6fb1);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xff6c70aa);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_standardContrast_primary() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xff545999);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xff555992);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_maxContrast_primary() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), false, 1.0);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xff161a59);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xff181c51);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -69,21 +85,21 @@ public final class SchemeTonalSpotTest extends SysuiTestCase {
|
||||
public void lightTheme_maxContrast_primaryContainer() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), false, 1.0);
|
||||
assertThat(MaterialDynamicColors.primaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xff383c7c);
|
||||
0xff3a3e74);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_minContrast_onPrimaryContainer() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), false, -1.0);
|
||||
assertThat(MaterialDynamicColors.onPrimaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xff5a5fa0);
|
||||
0xff5C5F98);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_standardContrast_onPrimaryContainer() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
assertThat(MaterialDynamicColors.onPrimaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xff0e1253);
|
||||
0xff11144B);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -96,37 +112,37 @@ public final class SchemeTonalSpotTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void lightTheme_minContrast_surface() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), false, -1.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xfffbf8ff);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xffFCF8FD);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_standardContrast_surface() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xfffbf8ff);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xffFCF8FD);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_maxContrast_surface() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), false, 1.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xfffbf8ff);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xffFCF8FD);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_minContrast_onSurface() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), false, -1.0);
|
||||
assertThat(MaterialDynamicColors.onSurface.getArgb(scheme)).isSameColorAs(0xff5f5e65);
|
||||
assertThat(MaterialDynamicColors.onSurface.getArgb(scheme)).isSameColorAs(0xff605E62);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_standardContrast_onSurface() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
assertThat(MaterialDynamicColors.onSurface.getArgb(scheme)).isSameColorAs(0xff1b1b21);
|
||||
assertThat(MaterialDynamicColors.onSurface.getArgb(scheme)).isSameColorAs(0xff1B1B1F);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_maxContrast_onSurface() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), false, 1.0);
|
||||
assertThat(MaterialDynamicColors.onSurface.getArgb(scheme)).isSameColorAs(0xff1a1a20);
|
||||
assertThat(MaterialDynamicColors.onSurface.getArgb(scheme)).isSameColorAs(0xff1B1A1E);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -186,7 +202,7 @@ public final class SchemeTonalSpotTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void darkTheme_minContrast_primary() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), true, -1.0);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xff6a6fb1);
|
||||
assertThat(MaterialDynamicColors.primary.getArgb(scheme)).isSameColorAs(0xff6C70AA);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -205,14 +221,14 @@ public final class SchemeTonalSpotTest extends SysuiTestCase {
|
||||
public void darkTheme_minContrast_primaryContainer() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), true, -1.0);
|
||||
assertThat(MaterialDynamicColors.primaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xff3c4180);
|
||||
0xff3E4278);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_standardContrast_primaryContainer() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), true, 0.0);
|
||||
assertThat(MaterialDynamicColors.primaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xff3c4180);
|
||||
0xff3E4278);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -226,7 +242,7 @@ public final class SchemeTonalSpotTest extends SysuiTestCase {
|
||||
public void darkTheme_minContrast_onPrimaryContainer() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), true, -1.0);
|
||||
assertThat(MaterialDynamicColors.onPrimaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xffabaff7);
|
||||
0xffadb0ef);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -240,7 +256,7 @@ public final class SchemeTonalSpotTest extends SysuiTestCase {
|
||||
public void darkTheme_maxContrast_onPrimaryContainer() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), true, 1.0);
|
||||
assertThat(MaterialDynamicColors.onPrimaryContainer.getArgb(scheme)).isSameColorAs(
|
||||
0xff2e3271);
|
||||
0xff30346A);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -321,36 +337,36 @@ public final class SchemeTonalSpotTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void darkTheme_minContrast_surface() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), true, -1.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff131318);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff131316);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_standardContrast_surface() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), true, 0.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff131318);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff131316);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_maxContrast_surface() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), true, 1.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff131318);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff131316);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_minContrast_onSurface() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), true, -1.0);
|
||||
assertThat(MaterialDynamicColors.onSurface.getArgb(scheme)).isSameColorAs(0xffa4a2a9);
|
||||
assertThat(MaterialDynamicColors.onSurface.getArgb(scheme)).isSameColorAs(0xffa4a2a6);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_standardContrast_onSurface() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), true, 0.0);
|
||||
assertThat(MaterialDynamicColors.onSurface.getArgb(scheme)).isSameColorAs(0xffe4e1e9);
|
||||
assertThat(MaterialDynamicColors.onSurface.getArgb(scheme)).isSameColorAs(0xffe5e1e6);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_maxContrast_onSurface() {
|
||||
SchemeTonalSpot scheme = new SchemeTonalSpot(Hct.fromInt(0xff0000ff), true, 1.0);
|
||||
assertThat(MaterialDynamicColors.onSurface.getArgb(scheme)).isSameColorAs(0xffe5e2ea);
|
||||
assertThat(MaterialDynamicColors.onSurface.getArgb(scheme)).isSameColorAs(0xffe6e2e7);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,22 @@ import org.junit.runners.JUnit4;
|
||||
@RunWith(JUnit4.class)
|
||||
public final class SchemeVibrantTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void testKeyColors() {
|
||||
SchemeVibrant scheme = new SchemeVibrant(Hct.fromInt(0xff0000ff), false, 0.0);
|
||||
|
||||
assertThat(MaterialDynamicColors.primaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff080CFF);
|
||||
assertThat(MaterialDynamicColors.secondaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff7B7296);
|
||||
assertThat(MaterialDynamicColors.tertiaryPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff886C9D);
|
||||
assertThat(MaterialDynamicColors.neutralPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff777682);
|
||||
assertThat(MaterialDynamicColors.neutralVariantPaletteKeyColor.getArgb(scheme))
|
||||
.isSameColorAs(0xff767685);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lightTheme_minContrast_primary() {
|
||||
SchemeVibrant scheme = new SchemeVibrant(Hct.fromInt(0xff0000ff), false, -1.0);
|
||||
@@ -195,18 +211,18 @@ public final class SchemeVibrantTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void darkTheme_minContrast_surface() {
|
||||
SchemeVibrant scheme = new SchemeVibrant(Hct.fromInt(0xff0000ff), true, -1.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff12131a);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff12131C);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_standardContrast_surface() {
|
||||
SchemeVibrant scheme = new SchemeVibrant(Hct.fromInt(0xff0000ff), true, 0.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff12131a);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff12131C);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void darkTheme_maxContrast_surface() {
|
||||
SchemeVibrant scheme = new SchemeVibrant(Hct.fromInt(0xff0000ff), true, 1.0);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff12131a);
|
||||
assertThat(MaterialDynamicColors.surface.getArgb(scheme)).isSameColorAs(0xff12131C);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user