Skip to content

Commit 19edbcc

Browse files
committed
[UI] Keep experimenting with better (??) ways to display black pieces' symbol
1 parent dd9f2be commit 19edbcc

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/apps/chess/components/chess_board.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ def chess_character_display(
574574
is_potential_capture = True # let's highlight checks in "see solution" mode
575575

576576
horizontal_translation = (
577-
("left-3" if is_knight else "left-0")
577+
("left-2" if (is_knight or is_king) else "left-0")
578578
if is_from_original_left_hand_side
579579
else "right-0"
580580
)
@@ -607,9 +607,9 @@ def chess_character_display(
607607
)
608608
if is_highlighted
609609
else (
610-
"drop-shadow-piece-symbol-w"
610+
"drop-shadow-piece-unit-w"
611611
if piece_player_side == "w"
612-
else "drop-shadow-piece-symbol-b"
612+
else "drop-shadow-piece-unit-b"
613613
)
614614
),
615615
"drop-shadow-potential-capture" if is_potential_capture else "",
@@ -675,9 +675,9 @@ def chess_unit_symbol_display(
675675

676676
is_knight, is_pawn = piece_type == "n", piece_type == "p"
677677

678-
# We always display a "w" symbol, because for some reason I find the board
679-
# game clearer that way. We'll just make it a bit less white for "b" pieces.
680-
unit_symbol_class = chess_unit_symbol_class(player_side="w", piece_name=piece_name)
678+
unit_symbol_class = chess_unit_symbol_class(
679+
player_side=player_side, piece_name=piece_name
680+
)
681681

682682
symbol_class = (
683683
# We have to do some ad-hoc adjustments for Knights and Pawns:
@@ -691,7 +691,6 @@ def chess_unit_symbol_display(
691691
if player_side == "w"
692692
else "drop-shadow-piece-symbol-b"
693693
),
694-
*(("brightness-60",) if player_side == "b" else []),
695694
unit_symbol_class,
696695
)
697696
symbol_display = div(

tailwind.config.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ const FACTIONS = ["humans", "undeads"]
1111
const PLAYABLE_SELECTION_COLOR = "#ffff00"
1212
const NON_PLAYABLE_SELECTION_COLOR = "#ffd000"
1313
const POTENTIAL_CAPTURE_COLOR = "#c00000"
14-
const PIECE_SYMBOL_BORDER_OPACITY = Math.round(0.4 * 0xff).toString(16) // 40% of 255
14+
const PIECE_UNIT_BORDER_OPACITY = Math.round(0.5 * 0xff).toString(16) // 50% of 255
15+
const PIECE_SYMBOL_BORDER_OPACITY = Math.round(0.9 * 0xff).toString(16) // 90% of 255
16+
const PIECE_UNIT_W = `#065f46${PIECE_UNIT_BORDER_OPACITY}` // emerald-800
17+
const PIECE_UNIT_B = `#3730a3${PIECE_UNIT_BORDER_OPACITY}` // indigo-800
1518
const PIECE_SYMBOL_W = `#065f46${PIECE_SYMBOL_BORDER_OPACITY}` // emerald-800
16-
const PIECE_SYMBOL_B = `#3730a3${PIECE_SYMBOL_BORDER_OPACITY}` // indigo-800
19+
const PIECE_SYMBOL_B = `#a855f7${PIECE_SYMBOL_BORDER_OPACITY}` // purple-500
1720
const PIECES_DROP_SHADOW_OFFSET = 1 // px
1821
const SPEECH_BUBBLE_DROP_SHADOW_COLOR = "#fbbf24" // amber-400
1922

@@ -82,8 +85,8 @@ module.exports = {
8285
size: "width, height",
8386
},
8487
dropShadow: {
85-
// "piece-symbol-w": `0 0 0.1rem ${PIECE_SYMBOL_W}`,
86-
// "piece-symbol-b": `0 0 0.1rem ${PIECE_SYMBOL_B}`,
88+
"piece-unit-w": borderFromDropShadow(1, PIECE_UNIT_W),
89+
"piece-unit-b": borderFromDropShadow(1, PIECE_UNIT_B),
8790
"piece-symbol-w": borderFromDropShadow(1, PIECE_SYMBOL_W),
8891
"piece-symbol-b": borderFromDropShadow(1, PIECE_SYMBOL_B),
8992
"playable-selected-piece": borderFromDropShadow(PIECES_DROP_SHADOW_OFFSET, PLAYABLE_SELECTION_COLOR),

0 commit comments

Comments
 (0)