Skip to content

Commit

Permalink
[WIP] add theme and non theme colors row
Browse files Browse the repository at this point in the history
  • Loading branch information
ryg-git committed Apr 13, 2024
1 parent f2d857f commit 0403fcb
Show file tree
Hide file tree
Showing 36 changed files with 73 additions and 8 deletions.
79 changes: 72 additions & 7 deletions theme/ch.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@

ms = importlib.import_module("make-sprites")

NONTHEME_COLORS = [
"#262421", # dark background
"#bababa", # text color
"#bf811d", # title color
"#b72fc6", # bot color
"#706f6e", # 50% text color on dark background
]

COLOR_WIDTH = SQUARE_SIZE * 2 // 3

def make_ch_sprite(piece_set_name: str):
svg = ET.Element(
Expand All @@ -18,7 +27,7 @@ def make_ch_sprite(piece_set_name: str):
"xmlns": "http://www.w3.org/2000/svg",
"version": "1.1",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
"viewBox": f"0 0 {SQUARE_SIZE * 8} {SQUARE_SIZE * 8}",
"viewBox": f"0 0 {SQUARE_SIZE * 8} {SQUARE_SIZE * 9}",
},
)

Expand All @@ -27,7 +36,37 @@ def make_ch_sprite(piece_set_name: str):
for g in ms.make_piece_set(piece_set_name):
defs.append(ET.fromstring(g))

for y in range(5):

for x, color in enumerate(NONTHEME_COLORS):
ET.SubElement(
svg,
"rect",
{
"x": str(SQUARE_SIZE * 4 + COLOR_WIDTH * x),
"y": "0",
"width": str(COLOR_WIDTH),
"height": str(SQUARE_SIZE),
"stroke": "none",
"fill": color,
},
)


ET.SubElement(
svg,
"rect",
{
"x": "0",
"y": "0",
"width": str(SQUARE_SIZE * 4),
"height": str(SQUARE_SIZE),
"stroke": "none",
"fill": "#888888",
},
)


for y in range(2, 6):
for x in range(8):
ET.SubElement(
svg,
Expand Down Expand Up @@ -69,7 +108,7 @@ def make_ch_sprite(piece_set_name: str):
svg,
"image",
{
"xlink:href": f"ch-numbers/ch{y}.png",
"xlink:href": f"ch-numbers/ch{y - 1}.png",
"transform": f"translate({SQUARE_SIZE * (x + 0.60)}, {SQUARE_SIZE * (y + 0.60)})",
"width": "15",
"height": "15"
Expand All @@ -82,7 +121,33 @@ def make_ch_sprite(piece_set_name: str):
"rect",
{
"x": str(SQUARE_SIZE * x),
"y": str(SQUARE_SIZE * 5),
"y": str(SQUARE_SIZE),
"width": str(SQUARE_SIZE),
"height": str(SQUARE_SIZE),
"stroke": "none",
"fill": "#888888",
},
)

color = "w" if x >= 4 else "b"

ET.SubElement(
svg,
"use",
{
"xlink:href": f"#{color}{ms.PIECE_TYPES[1 + x % 4]}",
"transform": f"translate({SQUARE_SIZE * x}, {SQUARE_SIZE})",
"opacity": "0.1",
},
)

for x in range(8):
ET.SubElement(
svg,
"rect",
{
"x": str(SQUARE_SIZE * x),
"y": str(SQUARE_SIZE * 6),
"width": str(SQUARE_SIZE),
"height": str(SQUARE_SIZE),
"stroke": "none",
Expand All @@ -97,12 +162,12 @@ def make_ch_sprite(piece_set_name: str):
"use",
{
"xlink:href": f"#{color}{ms.PIECE_TYPES[0]}",
"transform": f"translate({SQUARE_SIZE * x}, {SQUARE_SIZE * 5})",
"transform": f"translate({SQUARE_SIZE * x}, {SQUARE_SIZE * 6})",
"opacity": "0.1",
},
)

for y in range(6, 8):
for y in range(7, 9):
for x in range(8):
ET.SubElement(
svg,
Expand All @@ -117,7 +182,7 @@ def make_ch_sprite(piece_set_name: str):
},
)

color = "w" if y == 7 else "b"
color = "w" if y == 8 else "b"

ET.SubElement(
svg,
Expand Down
2 changes: 1 addition & 1 deletion theme/make-sprites.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def make_sprite(theme_name: str, piece_set_name: str):
"xmlns": "http://www.w3.org/2000/svg",
"version": "1.1",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
"viewBox": f"0 0 {SQUARE_SIZE * 8} {SQUARE_SIZE * 9}",
"viewBox": f"0 0 {SQUARE_SIZE * 8} {SQUARE_SIZE * 8}",
},
)

Expand Down
Binary file modified theme/sprites/crazyhouse-alpha.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-anarcandy.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-caliente.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-california.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-cardinal.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-cburnett.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-celtic.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-chess7.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-chessnut.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-companion.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-disguised.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-dubrovny.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-fantasy.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-fresca.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-gioco.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-governor.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-horsey.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-icpieces.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-kiwen-suwi.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-kosal.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-leipzig.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-letter.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-libra.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-maestro.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-merida.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme/sprites/crazyhouse-mpchess.gif
Binary file modified theme/sprites/crazyhouse-pirouetti.gif
Binary file modified theme/sprites/crazyhouse-pixel.gif
Binary file modified theme/sprites/crazyhouse-reillycraig.gif
Binary file modified theme/sprites/crazyhouse-riohacha.gif
Binary file modified theme/sprites/crazyhouse-shapes.gif
Binary file modified theme/sprites/crazyhouse-spatial.gif
Binary file modified theme/sprites/crazyhouse-staunty.gif
Binary file modified theme/sprites/crazyhouse-tatiana.gif

0 comments on commit 0403fcb

Please sign in to comment.