feat(lichess): board related elements & new options (#1879)

Co-authored-by: uncenter <[email protected]>
This commit is contained in:
Jeff Wanganduncenter authored and GitHub committed 2025-09-07 22:18:25 -04:00
1 parent d64b7bc159
commit 6a8a544e73
1 file changed
+85 -45
+85 -45
View File
@@ -13,7 +13,11 @@
@var select lightFlavor "Light Flavor" ["latte:Latte*", "frappe:Frappé", "macchiato:Macchiato", "mocha:Mocha"]
@var select darkFlavor "Dark Flavor" ["latte:Latte", "frappe:Frappé", "macchiato:Macchiato", "mocha:Mocha*"]
@var select accentColor "Accent" ["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 lastMoveColor "Last Move" ["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 checkColor "Check Indicator" ["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 stylePieces "Style Pieces" 1
@var checkbox styleBoard "Style Board" 1
==/UserStyle== */
@import "https://userstyles.catppuccin.com/lib/lib.less";
@@ -38,6 +42,9 @@
#lib.palette();
#lib.defaults();
@lastMove: @catppuccin[@@flavor][@@lastMoveColor];
@check: @catppuccin[@@flavor][@@checkColor];
&,
body {
background: @base linear-gradient(to bottom, @crust, @base 116px)
@@ -243,11 +250,80 @@
}
/* Chess Game */
.brown .is2d cg-board {
@svg: escape(
'<svg shape-rendering="crispEdges" viewBox="0 0 8 8" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="f"><g id="e"><g id="d"><g id="c"><path id="a" d="M0 0h1v1H0z" fill="@{subtext0}"/><use x="1" xlink:href="#a" y="1"/><path id="b" d="M0 1h1v1H0z" fill="@{crust}"/><use x="1" xlink:href="#b" y="-1"/></g><use x="2" xlink:href="#c"/></g><use x="4" xlink:href="#d"/></g><use xlink:href="#e" y="2"/></g><use xlink:href="#f" y="4"/></svg>'
);
background-image: url("data:image/svg+xml,@{svg}") !important;
@light-cell: if(@flavor = latte, @surface0, @accent);
@dark-cell: if(@flavor = latte, @accent, @surface0);
& when (@styleBoard = 1) {
/* Board */
.is2d cg-board::before {
@svg: escape(
'<svg shape-rendering="crispEdges" viewBox="0 0 8 8" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="f"><g id="e"><g id="d"><g id="c"><path id="a" d="M0 0h1v1H0z" fill="@{light-cell}"/><use x="1" xlink:href="#a" y="1"/><path id="b" d="M0 1h1v1H0z" fill="@{dark-cell}"/><use x="1" xlink:href="#b" y="-1"/></g><use x="2" xlink:href="#c"/></g><use x="4" xlink:href="#d"/></g><use xlink:href="#e" y="2"/></g><use xlink:href="#f" y="4"/></svg>'
);
background-image: url("data:image/svg+xml,@{svg}") !important;
}
/* File and Rank Coords */
.orientation-white .files coord:nth-child(2n+1),
.orientation-white .ranks coord:nth-child(2n),
.orientation-black .files coord:nth-child(2n),
.orientation-black .ranks coord:nth-child(2n+1) {
color: @light-cell;
}
.orientation-white .files coord:nth-child(2n),
.orientation-white .ranks coord:nth-child(2n+1),
.orientation-black .files coord:nth-child(2n+1),
.orientation-black .ranks coord:nth-child(2n) {
color: @dark-cell;
}
/* Squares */
square {
&.move-dest {
background: radial-gradient(
@overlay1 19%,
rgba(0, 0, 0, 0) 20%
);
}
&.selected {
background: fade(@accent, 50%);
}
&.last-move {
background-color: fade(@lastMove, 75%);
}
&.check {
background: radial-gradient(
ellipse at center,
@check 0%,
@check 25%,
fade(@check, 0%) 89%,
fade(@check, 0%) 100%
);
}
/* Capture indicator */
&.oc.move-dest {
background: radial-gradient(
transparent 0%,
transparent 79%,
fade(@overlay1, 50%) 80%
);
}
}
/* Analysis Arrows */
svg.cg-shapes g {
&[cgHash$="green"] {
filter: @green-filter;
}
&[cgHash$="paleBlue"] {
filter: @sky-filter;
}
&[cgHash$="red"] {
filter: @red-filter;
}
}
}
& when (@stylePieces = 1) {
.is2d .pawn {
@@ -336,30 +412,6 @@
}
}
.orientation-white .files coord:nth-child(2n+1),
.orientation-white .ranks coord:nth-child(2n),
.orientation-black .files coord:nth-child(2n),
.orientation-black .ranks coord:nth-child(2n+1) {
color: @base;
}
.orientation-white .files coord:nth-child(2n),
.orientation-white .ranks coord:nth-child(2n+1),
.orientation-black .files coord:nth-child(2n+1),
.orientation-black .ranks coord:nth-child(2n) {
color: @crust;
}
square.move-dest {
background: radial-gradient(
fade(@accent, 50%) 19%,
rgba(0, 0, 0, 0) 20%
);
}
square.selected {
background: fade(@accent, 50%);
}
square.last-move {
background: fade(@accent, 40%);
}
.rclock .time {
background: @mantle;
color: @text;
@@ -371,19 +423,6 @@
background: @accent;
}
/* Analysis Arrows */
svg.cg-shapes g {
&[cgHash$="green"] {
filter: @green-filter;
}
&[cgHash$="paleBlue"] {
filter: @sky-filter;
}
&[cgHash$="red"] {
filter: @red-filter;
}
}
/* Game Cards */
.game__meta,
.round__app__table {
@@ -500,14 +539,15 @@
}
.ceval .bar span {
background: @green;
&.threat {
background: @red;
}
}
.show-threat.active,
.show-threat:hover:not(.hidden) {
color: @red;
}
.ceval .bar span.threat {
background: @red;
}
/* Openings */
.opening__config,
.opening__next {