mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
140 lines
2.4 KiB
SCSS
140 lines
2.4 KiB
SCSS
@mixin move-indicator {
|
|
display: block;
|
|
content: "";
|
|
width: 2vmin;
|
|
height: 2vmin;
|
|
position: absolute;
|
|
right: 2vmin;
|
|
border-radius: 50%;
|
|
}
|
|
|
|
.board {
|
|
background: lighten($black-square-color, 7%);
|
|
border-collapse: unset;
|
|
border-spacing: 1px;
|
|
color: $white-square-color;
|
|
border-radius: 2vmin;
|
|
box-shadow: 0 0.5vmin 3vmin rgba(0, 0, 0, 0.4);
|
|
position: relative;
|
|
height: 90vmin;
|
|
width: 90vmin;
|
|
|
|
th {
|
|
font-size: 0.6rem;
|
|
color: darken($black-square-color, 10%);
|
|
}
|
|
|
|
&.white-to-move:before {
|
|
@include move-indicator;
|
|
background: #fff;
|
|
}
|
|
|
|
&.black-to-move:before {
|
|
@include move-indicator;
|
|
background: #000;
|
|
}
|
|
|
|
&.player-is-white.white-to-move:before,
|
|
&.player-is-black.black-to-move:before {
|
|
bottom: 2vmin;
|
|
}
|
|
|
|
&.player-is-white.black-to-move:before,
|
|
&.player-is-black.white-to-move:before {
|
|
top: 2vmin;
|
|
}
|
|
}
|
|
|
|
@media (min-width: 480px) {
|
|
.board {
|
|
border-spacing: 2px;
|
|
|
|
th {
|
|
font-size: 0.8rem;
|
|
}
|
|
}
|
|
}
|
|
|
|
@media (min-width: 768px) {
|
|
.board {
|
|
border-spacing: 3px;
|
|
|
|
th {
|
|
font-size: 1rem;
|
|
}
|
|
}
|
|
}
|
|
|
|
.board-square {
|
|
background-position: center;
|
|
background-repeat: no-repeat;
|
|
background-size: 100%;
|
|
border-radius: 0.25vmin;
|
|
|
|
@each $colour in $colours {
|
|
@each $piece in $pieces {
|
|
&.#{$colour}.#{$piece} {
|
|
background-image: url(/images/#{$piece}_#{$colour}.svg);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.board-border-top,
|
|
.board-border-bottom {
|
|
height: 5%;
|
|
|
|
th {
|
|
padding: 0;
|
|
vertical-align: middle;
|
|
text-align: center;
|
|
}
|
|
}
|
|
|
|
.board-border-left,
|
|
.board-border-right {
|
|
width: 5%;
|
|
|
|
padding: 0;
|
|
vertical-align: middle;
|
|
text-align: center;
|
|
}
|
|
|
|
@mixin black-square {
|
|
background-color: $black-square-color;
|
|
|
|
&.selected {
|
|
background-color: mix($black-square-color, $selected-square-color, 60%);
|
|
outline: 0.2vmin solid $selected-outline-color;
|
|
}
|
|
}
|
|
|
|
@mixin white-square {
|
|
background-color: $white-square-color;
|
|
|
|
&.selected {
|
|
background-color: mix($white-square-color, $selected-square-color, 60%);
|
|
outline: 0.2vmin solid $selected-outline-color;
|
|
}
|
|
}
|
|
|
|
.board-rank:nth-child(odd) {
|
|
.board-square:nth-child(even) {
|
|
@include black-square;
|
|
}
|
|
|
|
.board-square:nth-child(odd) {
|
|
@include white-square;
|
|
}
|
|
}
|
|
|
|
.board-rank:nth-child(even) {
|
|
.board-square:nth-child(even) {
|
|
@include white-square;
|
|
}
|
|
|
|
.board-square:nth-child(odd) {
|
|
@include black-square;
|
|
}
|
|
}
|