diff --git a/src/client/graphics/SpriteLoader.ts b/src/client/graphics/SpriteLoader.ts index d7836efb8..53d4f2575 100644 --- a/src/client/graphics/SpriteLoader.ts +++ b/src/client/graphics/SpriteLoader.ts @@ -76,10 +76,11 @@ export const getColoredSprite = ( unit: UnitView, theme: Theme, customTerritoryColor?: Colord, + customBorderColor?: Colord, ): HTMLCanvasElement => { const owner = unit.owner(); const territoryColor = customTerritoryColor ?? theme.territoryColor(owner); - const borderColor = theme.borderColor(owner); + const borderColor = customBorderColor ?? theme.borderColor(owner); const spawnHighlightColor = theme.spawnHighlightColor(); const colorKey = customTerritoryColor ? customTerritoryColor.toRgbString() diff --git a/src/client/graphics/layers/UnitLayer.ts b/src/client/graphics/layers/UnitLayer.ts index d03957e04..716791f80 100644 --- a/src/client/graphics/layers/UnitLayer.ts +++ b/src/client/graphics/layers/UnitLayer.ts @@ -479,7 +479,29 @@ export class UnitLayer implements Layer { const x = this.game.x(unit.tile()); const y = this.game.y(unit.tile()); - const sprite = getColoredSprite(unit, this.theme, customTerritoryColor); + let alternateViewColor = null; + + if (this.alternateView) { + const rel = this.relationship(unit); + switch (rel) { + case Relationship.Self: + alternateViewColor = this.theme.selfColor(); + break; + case Relationship.Ally: + alternateViewColor = this.theme.allyColor(); + break; + case Relationship.Enemy: + alternateViewColor = this.theme.enemyColor(); + break; + } + } + + const sprite = getColoredSprite( + unit, + this.theme, + alternateViewColor ?? customTerritoryColor, + alternateViewColor, + ); this.context.drawImage( sprite,