Add checkered colors for defended borders (#691)

## Description:

The borders near a defense post are currently colored differently, but
too discreetly for the user.

I suggest coloring them with a checkerboard pattern.


![image](https://github.com/user-attachments/assets/8f414976-bada-4793-812a-10f28da911f5)

![image](https://github.com/user-attachments/assets/81261148-88e3-4498-9f29-27a6a201b6c5)


## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

IngloriousTom
This commit is contained in:
DevelopingTom
2025-05-10 15:17:51 +02:00
committed by GitHub
parent 1c6c4c0512
commit 890972cb0c
4 changed files with 20 additions and 31 deletions
+7 -9
View File
@@ -267,15 +267,13 @@ export class TerritoryLayer implements Layer {
)
.filter((u) => u.unit.owner() == owner).length > 0
) {
const useDefendedBorderColor = playerIsFocused
? this.theme.focusedDefendedBorderColor()
: this.theme.defendedBorderColor(owner);
this.paintCell(
this.game.x(tile),
this.game.y(tile),
useDefendedBorderColor,
255,
);
const borderColors = this.theme.defendedBorderColors(owner);
const x = this.game.x(tile);
const y = this.game.y(tile);
const lightTile =
(x % 2 == 0 && y % 2 == 0) || (y % 2 == 1 && x % 2 == 1);
const borderColor = lightTile ? borderColors.light : borderColors.dark;
this.paintCell(x, y, borderColor, 255);
} else {
const useBorderColor = playerIsFocused
? this.theme.focusedBorderColor()
+1 -2
View File
@@ -143,9 +143,8 @@ export interface Theme {
territoryColor(playerInfo: PlayerView): Colord;
specialBuildingColor(playerInfo: PlayerView): Colord;
borderColor(playerInfo: PlayerView): Colord;
defendedBorderColor(playerInfo: PlayerView): Colord;
defendedBorderColors(playerInfo: PlayerView): { light: Colord; dark: Colord };
focusedBorderColor(): Colord;
focusedDefendedBorderColor(): Colord;
terrainColor(gm: GameMap, tile: TileRef): Colord;
backgroundColor(): Colord;
falloutColor(): Colord;
+6 -10
View File
@@ -98,21 +98,17 @@ export const pastelTheme = new (class implements Theme {
b: Math.max(tc.b - 40, 0),
});
}
defendedBorderColor(player: PlayerView): Colord {
const bc = this.borderColor(player).rgba;
return colord({
r: Math.max(bc.r - 40, 0),
g: Math.max(bc.g - 40, 0),
b: Math.max(bc.b - 40, 0),
});
defendedBorderColors(player: PlayerView): { light: Colord; dark: Colord } {
return {
light: this.territoryColor(player).darken(0.2),
dark: this.territoryColor(player).darken(0.4),
};
}
focusedBorderColor(): Colord {
return colord({ r: 230, g: 230, b: 230 });
}
focusedDefendedBorderColor(): Colord {
return colord({ r: 200, g: 200, b: 200 });
}
terrainColor(gm: GameMap, tile: TileRef): Colord {
const mag = gm.magnitude(tile);
+6 -10
View File
@@ -98,21 +98,17 @@ export const pastelThemeDark = new (class implements Theme {
b: Math.max(tc.b - 40, 0),
});
}
defendedBorderColor(player: PlayerView): Colord {
const bc = this.borderColor(player).rgba;
return colord({
r: Math.max(bc.r - 40, 0),
g: Math.max(bc.g - 40, 0),
b: Math.max(bc.b - 40, 0),
});
defendedBorderColors(player: PlayerView): { light: Colord; dark: Colord } {
return {
light: this.territoryColor(player).darken(0.2),
dark: this.territoryColor(player).darken(0.4),
};
}
focusedBorderColor(): Colord {
return colord({ r: 255, g: 255, b: 255 });
}
focusedDefendedBorderColor(): Colord {
return colord({ r: 215, g: 215, b: 215 });
}
terrainColor(gm: GameMap, tile: TileRef): Colord {
const mag = gm.magnitude(tile);