Skip to content

Commit

Permalink
Rename tonal container APIs
Browse files Browse the repository at this point in the history
container -> container surface

For #400
  • Loading branch information
kirill-grouchnikov committed Jan 4, 2025
1 parent 36b3b66 commit 3eebd1a
Show file tree
Hide file tree
Showing 21 changed files with 224 additions and 224 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected void paintComponent(Graphics g) {
ExtendedContainerColorTokens colorTokens = skin.getBackgroundExtendedContainerTokens(
DecorationPainterUtils.getDecorationType(this));
accentedFill = colorTokens.getBaseContainerTokens()
.getContainerLow();
.getContainerSurfaceLow();
} else {
RadianceThemingSlices.DecorationAreaType decorationAreaType =
RadianceThemingCortex.ComponentOrParentChainScope.getDecorationType(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ public void paint(Graphics g) {
int xOffset = 0;

// Container colors
paintSquare(g2d, xOffset, height, colorTokens.getContainerLowest());
paintSquare(g2d, xOffset, height, colorTokens.getContainerSurfaceLowest());
xOffset += (height + smallGap);
paintSquare(g2d, xOffset, height, colorTokens.getContainerLow());
paintSquare(g2d, xOffset, height, colorTokens.getContainerSurfaceLow());
xOffset += (height + smallGap);
paintSquare(g2d, xOffset, height, colorTokens.getContainer());
paintSquare(g2d, xOffset, height, colorTokens.getContainerSurface());
xOffset += (height + smallGap);
paintSquare(g2d, xOffset, height, colorTokens.getContainerHigh());
paintSquare(g2d, xOffset, height, colorTokens.getContainerSurfaceHigh());
xOffset += (height + smallGap);
paintSquare(g2d, xOffset, height, colorTokens.getContainerHighest());
paintSquare(g2d, xOffset, height, colorTokens.getContainerSurfaceHighest());

xOffset += (height + bigGap);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected void paintComponent(Graphics g) {
int arc = 8;
int strokeThickness = 2;

g2d.setColor(colorTokens.getContainer());
g2d.setColor(colorTokens.getContainerSurface());
g2d.fillRoundRect(strokeThickness, strokeThickness,
width - 2 * strokeThickness + 1, height - 2 * strokeThickness + 1, arc, arc);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ private void paintTitleBackground(Graphics2D original, Component comp, int width
LinearGradientPaint gradientTop = new LinearGradientPaint(0, 0, width, 0,
new float[] { 0.0f, 0.5f, 1.0f },
new Color[] {
containerColorTokens.getContainer(),
isDark ? containerColorTokens.getContainerHighest() : containerColorTokens.getContainerLowest(),
containerColorTokens.getContainer() },
containerColorTokens.getContainerSurface(),
isDark ? containerColorTokens.getContainerSurfaceHighest() : containerColorTokens.getContainerSurfaceLowest(),
containerColorTokens.getContainerSurface() },
CycleMethod.REPEAT);
g2d.setPaint(gradientTop);
g2d.fillRect(0, 0, width, height);
Expand All @@ -187,9 +187,9 @@ private void paintTitleBackground(Graphics2D original, Component comp, int width
LinearGradientPaint gradientBottom = new LinearGradientPaint(0, 0, width, 0,
new float[] { 0.0f, 0.5f, 1.0f },
new Color[] {
isDark ? containerColorTokens.getContainerLowest() : containerColorTokens.getContainerHighest(),
containerColorTokens.getContainer(),
isDark ? containerColorTokens.getContainerLowest() : containerColorTokens.getContainerHighest()
isDark ? containerColorTokens.getContainerSurfaceLowest() : containerColorTokens.getContainerSurfaceHighest(),
containerColorTokens.getContainerSurface(),
isDark ? containerColorTokens.getContainerSurfaceLowest() : containerColorTokens.getContainerSurfaceHighest()
},
CycleMethod.REPEAT);
g2d.setPaint(gradientBottom);
Expand Down Expand Up @@ -266,9 +266,9 @@ private void paintExtraBackground(Graphics2D graphics, Container parent, Compone
-offset.x, 0, -offset.x + pWidth, 0,
new float[] { 0.0f, 0.5f, 1.0f },
new Color[] {
isDark ? containerColorTokens.getContainerLowest() : containerColorTokens.getContainerHighest(),
containerColorTokens.getContainer(),
isDark ? containerColorTokens.getContainerLowest() : containerColorTokens.getContainerHighest()
isDark ? containerColorTokens.getContainerSurfaceLowest() : containerColorTokens.getContainerSurfaceHighest(),
containerColorTokens.getContainerSurface(),
isDark ? containerColorTokens.getContainerSurfaceLowest() : containerColorTokens.getContainerSurfaceHighest()
},
CycleMethod.REPEAT);
Graphics2D g2d = (Graphics2D) graphics.create();
Expand Down Expand Up @@ -328,9 +328,9 @@ public void paintDecorationArea(Graphics2D graphics, Component comp,
-offset.x, 0, -offset.x + pWidth, 0,
new float[] { 0.0f, 0.5f, 1.0f },
new Color[] {
isDark ? containerColorTokens.getContainerLowest() : containerColorTokens.getContainerHighest(),
containerColorTokens.getContainer(),
isDark ? containerColorTokens.getContainerLowest() : containerColorTokens.getContainerHighest()
isDark ? containerColorTokens.getContainerSurfaceLowest() : containerColorTokens.getContainerSurfaceHighest(),
containerColorTokens.getContainerSurface(),
isDark ? containerColorTokens.getContainerSurfaceLowest() : containerColorTokens.getContainerSurfaceHighest()
},
CycleMethod.REPEAT);
Graphics2D g2d = (Graphics2D) graphics.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private void paintTitleBackground(Graphics2D graphics, Component comp,
ExtendedContainerColorTokens tileContainerTokens =
skin.getBackgroundExtendedContainerTokens(decorationAreaType);
if (this.baseDecorationPainter == null) {
graphics.setColor(tileContainerTokens.getBaseContainerTokens().getContainerHigh());
graphics.setColor(tileContainerTokens.getBaseContainerTokens().getContainerSurfaceHigh());
graphics.fillRect(0, 0, width, height);
} else {
this.baseDecorationPainter.paintDecorationArea(graphics, comp, decorationAreaType,
Expand Down Expand Up @@ -174,7 +174,7 @@ private void paintExtraBackground(Graphics2D graphics, Component comp,
this.baseDecorationPainter.paintDecorationArea(graphics, comp, decorationAreaType, width, height, skin);
} else {
graphics.setColor(tileContainerTokens.getBaseContainerTokens()
.getContainerHigh());
.getContainerSurfaceHigh());
graphics.fillRect(0, 0, width, height);
}
Graphics2D temp = (Graphics2D) graphics.create();
Expand Down Expand Up @@ -225,7 +225,7 @@ public void paintDecorationArea(Graphics2D graphics, Component comp,
contour, colorTokens);
} else {
graphics.setColor(colorTokens.getBaseContainerTokens()
.getContainerHigh());
.getContainerSurfaceHigh());
graphics.fill(contour);
}
Graphics2D temp = (Graphics2D) graphics.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ protected void fill(Graphics2D graphics, ExtendedContainerColorTokens colorToken
// flex - : medium fill

Color startColor = colorTokens.getBaseContainerTokens()
.getContainerLowest();
.getContainerSurfaceLowest();
Color endColor = colorTokens.getBaseContainerTokens()
.getContainer();
.getContainerSurface();

int gradientHeight = Math.max(FLEX_POINT, height + offsetY);
Paint paint = (gradientHeight == FLEX_POINT) ?
Expand Down Expand Up @@ -218,9 +218,9 @@ public void paintDecorationArea(Graphics2D graphics, Component comp,
Point offset = RadianceCoreUtilities.getOffsetInRootPaneCoords(comp);

Color startColor = colorTokens.getBaseContainerTokens()
.getContainerHigh();
.getContainerSurfaceHigh();
Color endColor = colorTokens.getBaseContainerTokens()
.getContainerHighest();
.getContainerSurfaceHighest();

int gradientHeight = Math.max(FLEX_POINT, comp.getHeight() + offset.y);
Paint paint = (gradientHeight == FLEX_POINT) ?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ public void paintContourBackground(Graphics g, Component comp, float width, floa

if ((shineWidth > 0) && (shineHeight > 0)) {
BufferedImage shineImage = getShineImage(comp, contour,
colorTokens.getContainerLowest(),
colorTokens.getContainerLow(),
colorTokens.getContainerSurfaceLowest(),
colorTokens.getContainerSurfaceLow(),
this.alpha, shineWidth, shineHeight);

Graphics2D graphics = (Graphics2D) g.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,28 @@ public boolean isDark() {
}

@Override
public Color getContainerLowest() {
return tonalContainerColorResolver.getContainerLowest(dynamicScheme);
public Color getContainerSurfaceLowest() {
return tonalContainerColorResolver.getContainerSurfaceLowest(dynamicScheme);
}

@Override
public Color getContainerLow() {
return tonalContainerColorResolver.getContainerLow(dynamicScheme);
public Color getContainerSurfaceLow() {
return tonalContainerColorResolver.getContainerSurfaceLow(dynamicScheme);
}

@Override
public Color getContainer() {
return tonalContainerColorResolver.getContainer(dynamicScheme);
public Color getContainerSurface() {
return tonalContainerColorResolver.getContainerSurface(dynamicScheme);
}

@Override
public Color getContainerHigh() {
return tonalContainerColorResolver.getContainerHigh(dynamicScheme);
public Color getContainerSurfaceHigh() {
return tonalContainerColorResolver.getContainerSurfaceHigh(dynamicScheme);
}

@Override
public Color getContainerHighest() {
return tonalContainerColorResolver.getContainerHighest(dynamicScheme);
public Color getContainerSurfaceHighest() {
return tonalContainerColorResolver.getContainerSurfaceHighest(dynamicScheme);
}

@Override
Expand All @@ -98,7 +98,7 @@ public Color getContainerOutlineVariant() {
}

@Override
public float getContainerDisabledAlpha() {
public float getContainerSurfaceDisabledAlpha() {
return 0.3f;
}

Expand Down Expand Up @@ -507,15 +507,15 @@ private static ContainerColorTokens overlay(ContainerColorTokens original,

// Apply overlay on the container tokens
Color containerLowest = RadianceColorUtilities.overlayColor(
original.getContainerLowest(), overlayWithAlpha);
original.getContainerSurfaceLowest(), overlayWithAlpha);
Color containerLow = RadianceColorUtilities.overlayColor(
original.getContainerLow(), overlayWithAlpha);
original.getContainerSurfaceLow(), overlayWithAlpha);
Color container = RadianceColorUtilities.overlayColor(
original.getContainer(), overlayWithAlpha);
original.getContainerSurface(), overlayWithAlpha);
Color containerHigh = RadianceColorUtilities.overlayColor(
original.getContainerHigh(), overlayWithAlpha);
original.getContainerSurfaceHigh(), overlayWithAlpha);
Color containerHighest = RadianceColorUtilities.overlayColor(
original.getContainerHighest(), overlayWithAlpha);
original.getContainerSurfaceHighest(), overlayWithAlpha);

// Leave on container and container outline tokens as they are
Color onContainer = original.getOnContainer();
Expand All @@ -530,27 +530,27 @@ public boolean isDark() {
}

@Override
public Color getContainerLowest() {
public Color getContainerSurfaceLowest() {
return containerLowest;
}

@Override
public Color getContainerLow() {
public Color getContainerSurfaceLow() {
return containerLow;
}

@Override
public Color getContainer() {
public Color getContainerSurface() {
return container;
}

@Override
public Color getContainerHigh() {
public Color getContainerSurfaceHigh() {
return containerHigh;
}

@Override
public Color getContainerHighest() {
public Color getContainerSurfaceHighest() {
return containerHighest;
}

Expand All @@ -575,7 +575,7 @@ public Color getContainerOutlineVariant() {
}

@Override
public float getContainerDisabledAlpha() {
public float getContainerSurfaceDisabledAlpha() {
return 0.4f;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
public interface ContainerColorTokens {
boolean isDark();

Color getContainerLowest();
Color getContainerLow();
Color getContainer();
Color getContainerHigh();
Color getContainerHighest();
Color getContainerSurfaceLowest();
Color getContainerSurfaceLow();
Color getContainerSurface();
Color getContainerSurfaceHigh();
Color getContainerSurfaceHighest();

Color getOnContainer();
Color getOnContainerVariant();

Color getContainerOutline();
Color getContainerOutlineVariant();

float getContainerDisabledAlpha();
float getContainerSurfaceDisabledAlpha();
float getOnContainerDisabledAlpha();
float getContainerOutlineDisabledAlpha();
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ public interface ContainerColorTokensSingleColorQuery {
Color query(ContainerColorTokens colorTokens);

ContainerColorTokensSingleColorQuery CONTAINER_LOWEST = (colorTokens) ->
colorTokens.getContainerLowest();
colorTokens.getContainerSurfaceLowest();
ContainerColorTokensSingleColorQuery CONTAINER_LOW = (colorTokens) ->
colorTokens.getContainerLow();
colorTokens.getContainerSurfaceLow();
ContainerColorTokensSingleColorQuery CONTAINER = (colorTokens) ->
colorTokens.getContainer();
colorTokens.getContainerSurface();
ContainerColorTokensSingleColorQuery CONTAINER_HIGH = (colorTokens) ->
colorTokens.getContainerHigh();
colorTokens.getContainerSurfaceHigh();
ContainerColorTokensSingleColorQuery CONTAINER_HIGHEST = (colorTokens) ->
colorTokens.getContainerHighest();
colorTokens.getContainerSurfaceHighest();

ContainerColorTokensSingleColorQuery CONTAINER_OUTLINE = (colorTokens) ->
colorTokens.getContainerOutline();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
import java.awt.*;

public interface PaletteContainerColorsResolver {
Color getContainerLowest(DynamicScheme dynamicScheme);
Color getContainerLow(DynamicScheme dynamicScheme);
Color getContainer(DynamicScheme dynamicScheme);
Color getContainerHigh(DynamicScheme dynamicScheme);
Color getContainerHighest(DynamicScheme dynamicScheme);
Color getContainerSurfaceLowest(DynamicScheme dynamicScheme);
Color getContainerSurfaceLow(DynamicScheme dynamicScheme);
Color getContainerSurface(DynamicScheme dynamicScheme);
Color getContainerSurfaceHigh(DynamicScheme dynamicScheme);
Color getContainerSurfaceHighest(DynamicScheme dynamicScheme);

Color getOnContainer(DynamicScheme dynamicScheme);
Color getOnContainerVariant(DynamicScheme dynamicScheme);
Expand Down
Loading

0 comments on commit 3eebd1a

Please sign in to comment.