material-color-utilities: add missing surface colors

This commit is contained in:
MM20 2023-06-28 21:55:48 +02:00
parent 4841fcfc69
commit 618b49cba3
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389

View File

@ -20,7 +20,9 @@ package scheme;
import palettes.CorePalette;
/** Represents a Material color scheme, a mapping of color roles to colors. */
/**
* Represents a Material color scheme, a mapping of color roles to colors.
*/
public class Scheme {
private int primary;
private int onPrimary;
@ -51,8 +53,16 @@ public class Scheme {
private int inverseSurface;
private int inverseOnSurface;
private int inversePrimary;
private int surfaceDim;
private int surfaceBright;
private int surfaceContainerLowest;
private int surfaceContainerLow;
private int surfaceContainer;
private int surfaceContainerHigh;
private int surfaceContainerHighest;
public Scheme() {}
public Scheme() {
}
public Scheme(
int primary,
@ -83,7 +93,15 @@ public class Scheme {
int scrim,
int inverseSurface,
int inverseOnSurface,
int inversePrimary) {
int inversePrimary,
int surfaceDim,
int surfaceBright,
int surfaceContainerLowest,
int surfaceContainerLow,
int surfaceContainer,
int surfaceContainerHigh,
int surfaceContainerHighest
) {
super();
this.primary = primary;
this.onPrimary = onPrimary;
@ -114,6 +132,13 @@ public class Scheme {
this.inverseSurface = inverseSurface;
this.inverseOnSurface = inverseOnSurface;
this.inversePrimary = inversePrimary;
this.surfaceDim = surfaceDim;
this.surfaceBright = surfaceBright;
this.surfaceContainerLowest = surfaceContainerLowest;
this.surfaceContainerLow = surfaceContainerLow;
this.surfaceContainer = surfaceContainer;
this.surfaceContainerHigh = surfaceContainerHigh;
this.surfaceContainerHighest = surfaceContainerHighest;
}
public static Scheme light(int argb) {
@ -152,7 +177,7 @@ public class Scheme {
.withOnErrorContainer(core.error.tone(10))
.withBackground(core.n1.tone(99))
.withOnBackground(core.n1.tone(10))
.withSurface(core.n1.tone(99))
.withSurface(core.n1.tone(98))
.withOnSurface(core.n1.tone(10))
.withSurfaceVariant(core.n2.tone(90))
.withOnSurfaceVariant(core.n2.tone(30))
@ -162,7 +187,14 @@ public class Scheme {
.withScrim(core.n1.tone(0))
.withInverseSurface(core.n1.tone(20))
.withInverseOnSurface(core.n1.tone(95))
.withInversePrimary(core.a1.tone(80));
.withInversePrimary(core.a1.tone(80))
.withSurfaceDim(core.n1.tone(87))
.withSurfaceBright(core.n1.tone(98))
.withSurfaceContainerLowest(core.n1.tone(100))
.withSurfaceContainerLow(core.n1.tone(96))
.withSurfaceContainer(core.n1.tone(94))
.withSurfaceContainerHigh(core.n1.tone(92))
.withSurfaceContainerHighest(core.n1.tone(90));
}
private static Scheme darkFromCorePalette(CorePalette core) {
@ -185,7 +217,7 @@ public class Scheme {
.withOnErrorContainer(core.error.tone(80))
.withBackground(core.n1.tone(10))
.withOnBackground(core.n1.tone(90))
.withSurface(core.n1.tone(10))
.withSurface(core.n1.tone(6))
.withOnSurface(core.n1.tone(90))
.withSurfaceVariant(core.n2.tone(30))
.withOnSurfaceVariant(core.n2.tone(80))
@ -195,7 +227,14 @@ public class Scheme {
.withScrim(core.n1.tone(0))
.withInverseSurface(core.n1.tone(90))
.withInverseOnSurface(core.n1.tone(20))
.withInversePrimary(core.a1.tone(40));
.withInversePrimary(core.a1.tone(40))
.withSurfaceDim(core.n1.tone(6))
.withSurfaceBright(core.n1.tone(24))
.withSurfaceContainerLowest(core.n1.tone(4))
.withSurfaceContainerLow(core.n1.tone(10))
.withSurfaceContainer(core.n1.tone(12))
.withSurfaceContainerHigh(core.n1.tone(17))
.withSurfaceContainerHighest(core.n1.tone(22));
}
public int getPrimary() {
@ -575,6 +614,97 @@ public class Scheme {
return this;
}
public int getSurfaceDim() {
return surfaceDim;
}
public void setSurfaceDim(int surfaceDim) {
this.surfaceDim = surfaceDim;
}
public Scheme withSurfaceDim(int surfaceDim) {
this.surfaceDim = surfaceDim;
return this;
}
public int getSurfaceBright() {
return surfaceBright;
}
public void setSurfaceBright(int surfaceBright) {
this.surfaceBright = surfaceBright;
}
public Scheme withSurfaceBright(int surfaceBright) {
this.surfaceBright = surfaceBright;
return this;
}
public int getSurfaceContainerLowest() {
return surfaceContainerLowest;
}
public void setSurfaceContainerLowest(int surfaceContainerLowest) {
this.surfaceContainerLowest = surfaceContainerLowest;
}
public Scheme withSurfaceContainerLowest(int surfaceContainerLowest) {
this.surfaceContainerLowest = surfaceContainerLowest;
return this;
}
public int getSurfaceContainerLow() {
return surfaceContainerLow;
}
public void setSurfaceContainerLow(int surfaceContainerLow) {
this.surfaceContainerLow = surfaceContainerLow;
}
public Scheme withSurfaceContainerLow(int surfaceContainerLow) {
this.surfaceContainerLow = surfaceContainerLow;
return this;
}
public int getSurfaceContainer() {
return surfaceContainer;
}
public void setSurfaceContainer(int surfaceContainer) {
this.surfaceContainer = surfaceContainer;
}
public Scheme withSurfaceContainer(int surfaceContainer) {
this.surfaceContainer = surfaceContainer;
return this;
}
public int getSurfaceContainerHigh() {
return surfaceContainerHigh;
}
public void setSurfaceContainerHigh(int surfaceContainerHigh) {
this.surfaceContainerHigh = surfaceContainerHigh;
}
public Scheme withSurfaceContainerHigh(int surfaceContainerHigh) {
this.surfaceContainerHigh = surfaceContainerHigh;
return this;
}
public int getSurfaceContainerHighest() {
return surfaceContainerHighest;
}
public void setSurfaceContainerHighest(int surfaceContainerHighest) {
this.surfaceContainerHighest = surfaceContainerHighest;
}
public Scheme withSurfaceContainerHighest(int surfaceContainerHighest) {
this.surfaceContainerHighest = surfaceContainerHighest;
return this;
}
@Override
public String toString() {
return "Scheme{"
@ -636,6 +766,20 @@ public class Scheme {
+ inverseOnSurface
+ ", inversePrimary="
+ inversePrimary
+ ", surfaceDim="
+ surfaceDim
+ ", surfaceBright="
+ surfaceBright
+ ", surfaceContainerLowest="
+ surfaceContainerLowest
+ ", surfaceContainerLow="
+ surfaceContainerLow
+ ", surfaceContainer="
+ surfaceContainer
+ ", surfaceContainerHigh="
+ surfaceContainerHigh
+ ", surfaceContainerHighest="
+ surfaceContainerHighest
+ '}';
}
@ -740,6 +884,27 @@ public class Scheme {
if (inversePrimary != scheme.inversePrimary) {
return false;
}
if (surfaceDim != scheme.surfaceDim) {
return false;
}
if (surfaceBright != scheme.surfaceBright) {
return false;
}
if (surfaceContainerLowest != scheme.surfaceContainerLowest) {
return false;
}
if (surfaceContainerLow != scheme.surfaceContainerLow) {
return false;
}
if (surfaceContainer != scheme.surfaceContainer) {
return false;
}
if (surfaceContainerHigh != scheme.surfaceContainerHigh) {
return false;
}
if (surfaceContainerHighest != scheme.surfaceContainerHighest) {
return false;
}
return true;
}
@ -776,6 +941,13 @@ public class Scheme {
result = 31 * result + inverseSurface;
result = 31 * result + inverseOnSurface;
result = 31 * result + inversePrimary;
result = 31 * result + surfaceDim;
result = 31 * result + surfaceBright;
result = 31 * result + surfaceContainerLowest;
result = 31 * result + surfaceContainerLow;
result = 31 * result + surfaceContainer;
result = 31 * result + surfaceContainerHigh;
result = 31 * result + surfaceContainerHighest;
return result;
}
}