feat(chess.com): add option to style board & pieces (#1761)

Co-authored-by: uncenter <[email protected]>
Co-authored-by: isabel <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-06-04 14:43:53 +01:00
1 parent af7b349063
commit 21010f21fc
1 file changed
+79 -71
+79 -71
View File
@@ -18,6 +18,7 @@
@var select highlightColor2 "Highlight 2" ["rosewater:Rosewater", "flamingo:Flamingo", "pink:Pink", "mauve:Mauve", "red:Red", "maroon:Maroon", "peach:Peach", "yellow:Yellow", "green:Green*", "teal:Teal", "blue:Blue", "sapphire:Sapphire", "sky:Sky", "lavender:Lavender", "subtext0:Gray"] @var select highlightColor2 "Highlight 2" ["rosewater:Rosewater", "flamingo:Flamingo", "pink:Pink", "mauve:Mauve", "red:Red", "maroon:Maroon", "peach:Peach", "yellow:Yellow", "green:Green*", "teal:Teal", "blue:Blue", "sapphire:Sapphire", "sky:Sky", "lavender:Lavender", "subtext0:Gray"]
@var select highlightColor3 "Highlight 3" ["rosewater:Rosewater", "flamingo:Flamingo", "pink:Pink", "mauve:Mauve", "red:Red", "maroon:Maroon", "peach:Peach*", "yellow:Yellow", "green:Green", "teal:Teal", "blue:Blue", "sapphire:Sapphire", "sky:Sky", "lavender:Lavender", "subtext0:Gray"] @var select highlightColor3 "Highlight 3" ["rosewater:Rosewater", "flamingo:Flamingo", "pink:Pink", "mauve:Mauve", "red:Red", "maroon:Maroon", "peach:Peach*", "yellow:Yellow", "green:Green", "teal:Teal", "blue:Blue", "sapphire:Sapphire", "sky:Sky", "lavender:Lavender", "subtext0:Gray"]
@var select highlightColor4 "Highlight 4" ["rosewater:Rosewater", "flamingo:Flamingo", "pink:Pink", "mauve:Mauve", "red:Red", "maroon:Maroon", "peach:Peach", "yellow:Yellow", "green:Green", "teal:Teal", "blue:Blue*", "sapphire:Sapphire", "sky:Sky", "lavender:Lavender", "subtext0:Gray"] @var select highlightColor4 "Highlight 4" ["rosewater:Rosewater", "flamingo:Flamingo", "pink:Pink", "mauve:Mauve", "red:Red", "maroon:Maroon", "peach:Peach", "yellow:Yellow", "green:Green", "teal:Teal", "blue:Blue*", "sapphire:Sapphire", "sky:Sky", "lavender:Lavender", "subtext0:Gray"]
@var checkbox styleBoardAndPieces "Style Board & Pieces" 1
==/UserStyle== */ ==/UserStyle== */
@-moz-document domain("chess.com") { @-moz-document domain("chess.com") {
@@ -276,13 +277,14 @@
} }
} }
} }
.ui_v5-select-component { .ui_v5-select-component {
--borderColor: @surface0; --borderColor: @surface0;
--borderFocus: @surface1; --borderFocus: @surface1;
--bgColor: @base; --bgColor: @base;
--textColor: @text; --textColor: @text;
--arrowColor: @subtext0; --arrowColor: @subtext0;
} }
.ui_pagination-item-component { .ui_pagination-item-component {
--paginationColor: @text; --paginationColor: @text;
--paginationBgColor: @surface1; --paginationBgColor: @surface1;
@@ -497,6 +499,7 @@
background-color: @surface1; background-color: @surface1;
} }
.arrow { .arrow {
&[style*="rgba(248, 85, 63, 0.8)"] { &[style*="rgba(248, 85, 63, 0.8)"] {
fill: @highlight1 !important; fill: @highlight1 !important;
@@ -592,7 +595,6 @@
.popup-component { .popup-component {
background-color: @surface0; background-color: @surface0;
color: @text; color: @text;
&.popup-left .popup-arrow { &.popup-left .popup-arrow {
border-left-color: @surface0; border-left-color: @surface0;
} }
@@ -643,16 +645,19 @@
'<svg width="1600" height="1600" viewBox="0 0 1600 1600" xmlns="http://www.w3.org/2000/svg"><path fill="@{dark-cell}" d="M200 0v200h200V0Zm200 200v200h200V200Zm200 0h200V0H600Zm200 0v200h200V200Zm200 0h200V0h-200Zm200 0v200h200V200Zm200 0h200V0h-200zm0 200v200h200V400zm0 200h-200v200h200zm0 200v200h200V800Zm0 200h-200v200h200zm0 200v200h200v-200zm0 200h-200v200h200zm-200 0v-200h-200v200zm-200 0H800v200h200zm-200 0v-200H600v200zm-200 0H400v200h200zm-200 0v-200H200v200zm-200 0H0v200h200zm0-200v-200H0v200zm0-200h200V800H200Zm0-200V600H0v200zm0-200h200V400H200Zm0-200V200H0v200zm200 200v200h200V600Zm200 0h200V400H600Zm200 0v200h200V600Zm200 0h200V400h-200Zm0 200v200h200V800Zm0 200H800v200h200zm-200 0V800H600v200zm-200 0H400v200h200z"/><path fill="@{light-cell}" d="M0 0v200h200V0Zm200 200v200h200V200Zm200 0h200V0H400zm200 0v200h200V200Zm200 0h200V0H800Zm200 0v200h200V200Zm200 0h200V0h-200zm200 0v200h200V200Zm0 200h-200v200h200zm0 200v200h200V600Zm0 200h-200v200h200zm0 200v200h200v-200Zm0 200h-200v200h200zm0 200v200h200v-200zm-200 0h-200v200h200zm-200 0v-200H800v200zm-200 0H600v200h200zm-200 0v-200H400v200zm-200 0H200v200h200zm-200 0v-200H0v200zm0-200h200v-200H200Zm0-200V800H0v200zm0-200h200V600H200Zm0-200V400H0v200zm200 0h200V400H400zm200 0v200h200V600Zm200 0h200V400H800Zm200 0v200h200V600Zm0 200H800v200h200zm0 200v200h200v-200Zm-200 0H600v200h200zm-200 0V800H400v200z"/></svg>' '<svg width="1600" height="1600" viewBox="0 0 1600 1600" xmlns="http://www.w3.org/2000/svg"><path fill="@{dark-cell}" d="M200 0v200h200V0Zm200 200v200h200V200Zm200 0h200V0H600Zm200 0v200h200V200Zm200 0h200V0h-200Zm200 0v200h200V200Zm200 0h200V0h-200zm0 200v200h200V400zm0 200h-200v200h200zm0 200v200h200V800Zm0 200h-200v200h200zm0 200v200h200v-200zm0 200h-200v200h200zm-200 0v-200h-200v200zm-200 0H800v200h200zm-200 0v-200H600v200zm-200 0H400v200h200zm-200 0v-200H200v200zm-200 0H0v200h200zm0-200v-200H0v200zm0-200h200V800H200Zm0-200V600H0v200zm0-200h200V400H200Zm0-200V200H0v200zm200 200v200h200V600Zm200 0h200V400H600Zm200 0v200h200V600Zm200 0h200V400h-200Zm0 200v200h200V800Zm0 200H800v200h200zm-200 0V800H600v200zm-200 0H400v200h200z"/><path fill="@{light-cell}" d="M0 0v200h200V0Zm200 200v200h200V200Zm200 0h200V0H400zm200 0v200h200V200Zm200 0h200V0H800Zm200 0v200h200V200Zm200 0h200V0h-200zm200 0v200h200V200Zm0 200h-200v200h200zm0 200v200h200V600Zm0 200h-200v200h200zm0 200v200h200v-200Zm0 200h-200v200h200zm0 200v200h200v-200zm-200 0h-200v200h200zm-200 0v-200H800v200zm-200 0H600v200h200zm-200 0v-200H400v200zm-200 0H200v200h200zm-200 0v-200H0v200zm0-200h200v-200H200Zm0-200V800H0v200zm0-200h200V600H200Zm0-200V400H0v200zm200 0h200V400H400zm200 0v200h200V600Zm200 0h200V400H800Zm200 0v200h200V600Zm0 200H800v200h200zm0 200v200h200v-200Zm-200 0H600v200h200zm-200 0V800H400v200z"/></svg>'
); );
#board-play-computer, & when (@styleBoardAndPieces = 1) {
.fade-in-overlay { #board-play-computer,
background-image: url("data:image/svg+xml,@{board}"); .fade-in-overlay {
} background-image: url("data:image/svg+xml,@{board}");
}
.coordinate-light {
fill: @dark-cell;
}
.coordinate-dark {
fill: @light-cell;
}
.coordinate-light {
fill: @dark-cell;
}
.coordinate-dark {
fill: @light-cell;
} }
/* /*
@@ -707,65 +712,68 @@
@result: url("data:image/svg+xml,@{svg}"); @result: url("data:image/svg+xml,@{svg}");
} }
--theme-board-style-image: url("data:image/svg+xml,@{board}");
--theme-board-style-highlight-color: @highlight1;
--theme-piece-set-wp: #piece(@pawn, "white")[];
--theme-piece-set-wn: #piece(@knight, "white")[];
--theme-piece-set-wr: #piece(@rook, "white")[];
--theme-piece-set-wb: #piece(@bishop, "white")[];
--theme-piece-set-wq: #piece(@queen, "white")[];
--theme-piece-set-wk: #piece(@king, "white")[];
--theme-piece-set-bp: #piece(@pawn, "black")[];
--theme-piece-set-bn: #piece(@knight, "black")[];
--theme-piece-set-bb: #piece(@bishop, "black")[];
--theme-piece-set-br: #piece(@rook, "black")[];
--theme-piece-set-bq: #piece(@queen, "black")[];
--theme-piece-set-bk: #piece(@king, "black")[];
.board-popover-component { .board-popover-component {
background-color: @surface0; background-color: @surface0;
} }
.piece { & when (@styleBoardAndPieces = 1) {
/* Black */
&.bp {
background-image: #piece(@pawn, "black")[] !important;
}
&.bn {
background-image: #piece(@knight, "black")[] !important;
}
&.bb {
background-image: #piece(@bishop, "black")[] !important;
}
&.br {
background-image: #piece(@rook, "black")[] !important;
}
&.bk {
background-image: #piece(@king, "black")[] !important;
}
&.bq {
background-image: #piece(@queen, "black")[] !important;
}
/* White */ --theme-board-style-image: url("data:image/svg+xml,@{board}");
&.wp { --theme-board-style-highlight-color: @highlight1;
background-image: #piece(@pawn, "white")[] !important;
} --theme-piece-set-wp: #piece(@pawn, "white")[];
&.wn { --theme-piece-set-wn: #piece(@knight, "white")[];
background-image: #piece(@knight, "white")[] !important; --theme-piece-set-wr: #piece(@rook, "white")[];
} --theme-piece-set-wb: #piece(@bishop, "white")[];
&.wb { --theme-piece-set-wq: #piece(@queen, "white")[];
background-image: #piece(@bishop, "white")[] !important; --theme-piece-set-wk: #piece(@king, "white")[];
} --theme-piece-set-bp: #piece(@pawn, "black")[];
&.wr { --theme-piece-set-bn: #piece(@knight, "black")[];
background-image: #piece(@rook, "white")[] !important; --theme-piece-set-bb: #piece(@bishop, "black")[];
} --theme-piece-set-br: #piece(@rook, "black")[];
&.wk { --theme-piece-set-bq: #piece(@queen, "black")[];
background-image: #piece(@king, "white")[] !important; --theme-piece-set-bk: #piece(@king, "black")[];
}
&.wq { .piece {
background-image: #piece(@queen, "white")[] !important; /* Black */
&.bp {
background-image: #piece(@pawn, "black")[] !important;
}
&.bn {
background-image: #piece(@knight, "black")[] !important;
}
&.bb {
background-image: #piece(@bishop, "black")[] !important;
}
&.br {
background-image: #piece(@rook, "black")[] !important;
}
&.bk {
background-image: #piece(@king, "black")[] !important;
}
&.bq {
background-image: #piece(@queen, "black")[] !important;
}
/* White */
&.wp {
background-image: #piece(@pawn, "white")[] !important;
}
&.wn {
background-image: #piece(@knight, "white")[] !important;
}
&.wb {
background-image: #piece(@bishop, "white")[] !important;
}
&.wr {
background-image: #piece(@rook, "white")[] !important;
}
&.wk {
background-image: #piece(@king, "white")[] !important;
}
&.wq {
background-image: #piece(@queen, "white")[] !important;
}
} }
} }