Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

1. Make a skin in [Plinth's skin format](https://github.com/rubycatco/plinth/blob/main/docs/SKINS.md) and try it in Plinth at each fish size.
2. Put it in `skins/<id>/`, where `<id>` is lowercase letters, digits and hyphens, such as `paper-crane`. The id names the download, so choose one you'll keep.
3. In `skin.json`, besides `name`, and optionally `strike` and `voice`, add:
3. In `skin.json`, besides `name`, and optionally `names`, `strike` and `voice`, add:

```json
{
"name": "Paper Crane",
"names": { "zh-Hans": "纸鹤" },
"author": "Your Name (@you)",
"license": "CC0-1.0",
"voice": "bamboo"
Expand All @@ -28,7 +29,7 @@
- `idle.png` exists. Every PNG is square, has a transparent background, and frames are all the same size.
- Only skin files: `idle`, `blink` and `hit` frames (single or numbered from 1), `mallet.png`, `impact.png` and `skin.json`. No folders or links.
- The whole skin is under 3 MB.
- `skin.json` is valid JSON with `name`, `author` and `license`; `voice` is one of Plinth's twelve; `strike` is two numbers from 0 to 1.
- `skin.json` is valid JSON with `name`, `author` and `license`; `names`, if there, maps language codes to names; `voice` is one of Plinth's twenty-one; `strike` is two numbers from 0 to 1.

## Real people

Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Plinth Skins

Skins for [Plinth](https://github.com/rubycatco/plinth), the wooden fish on your Mac's desktop, made by the people who knock it.
Skins for [Plinth](https://github.com/rubycatco/plinth), the wooden fish on your Mac's desktop, made by the people who knock it. The first six shipped with Plinth itself before they moved here.

## Install a skin

Expand All @@ -11,7 +11,14 @@ To get them all at once, download `all-skins.zip` from the [latest release](http
## Gallery

<!-- gallery:start -->
No skins yet. [Add the first one](CONTRIBUTING.md).
| | Skin | By | Knock | |
| :-: | --- | --- | --- | --- |
| <img src="skins/abacus/idle.png" width="120" alt=""> | **Abacus** · 算盘 | Plinth | `bead` | [Download](https://github.com/rubycatco/plinth-skins/releases/latest/download/abacus.plinthskin) |
| <img src="skins/crt-terminal/idle.png" width="120" alt=""> | **CRT Terminal** · CRT 终端 | Plinth | `crt` | [Download](https://github.com/rubycatco/plinth-skins/releases/latest/download/crt-terminal.plinthskin) |
| <img src="skins/mug/idle.png" width="120" alt=""> | **Mug** · 马克杯 | Plinth | `ceramic` | [Download](https://github.com/rubycatco/plinth-skins/releases/latest/download/mug.plinthskin) |
| <img src="skins/piston/idle.png" width="120" alt=""> | **Piston** · 活塞 | Plinth | `piston` | [Download](https://github.com/rubycatco/plinth-skins/releases/latest/download/piston.plinthskin) |
| <img src="skins/seal/idle.png" width="120" alt=""> | **Seal** · 印章 | Plinth | `stamp` | [Download](https://github.com/rubycatco/plinth-skins/releases/latest/download/seal.plinthskin) |
| <img src="skins/space-key/idle.png" width="120" alt=""> | **Space Key** · 空格键 | Plinth | `key` | [Download](https://github.com/rubycatco/plinth-skins/releases/latest/download/space-key.plinthskin) |
<!-- gallery:end -->

## Add yours
Expand Down
14 changes: 11 additions & 3 deletions scripts/skins.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
DIST = os.path.join(ROOT, "dist")
RELEASE = "https://github.com/rubycatco/plinth-skins/releases/latest/download"

# KnockSynth.voices, in Plinth's Sources/PlinthCore/KnockSynth.swift.
VOICES = {"wood", "lacquer", "ink", "cartoon", "pixel", "jade", "bowl", "key",
"bamboo", "stone", "piston", "crt"}
"bamboo", "stone", "piston", "crt", "bead", "plate", "porcelain",
"bell", "stamp", "chime", "board", "ceramic", "temple"}
LICENSES = {"CC0-1.0", "CC-BY-4.0"}
FRAMES = re.compile(r"^(idle|blink|hit)(-[1-9][0-9]*)?\.png$")
OTHER = {"mallet.png", "impact.png", "skin.json"}
Expand Down Expand Up @@ -98,6 +100,10 @@ def check(skin):
for key in ("name", "author"):
if not isinstance(meta.get(key), str) or not meta[key].strip():
problems.append(f"skin.json: \"{key}\" is required")
names = meta.get("names")
if names is not None and not (isinstance(names, dict) and names
and all(isinstance(v, str) and v.strip() for v in names.values())):
problems.append("skin.json: \"names\" must map language codes to names, such as {\"zh-Hans\": \"纸鹤\"}")
if meta.get("license") not in LICENSES:
problems.append(f"skin.json: \"license\" must be one of {sorted(LICENSES)}")
if "voice" in meta and meta["voice"] not in VOICES:
Expand Down Expand Up @@ -132,8 +138,10 @@ def gallery(skins):
for name, meta in skins:
voice = meta.get("voice", "wood")
author = meta["author"].replace("|", "\\|")
title = meta["name"].replace("|", "\\|")
rows.append(f'| <img src="skins/{name}/idle.png" width="120" alt=""> | **{title}** | {author} | '
# The name, then its names in other languages.
others = meta.get("names", {})
title = " · ".join([f"**{meta['name']}**"] + [others[k] for k in sorted(others)]).replace("|", "\\|")
Comment on lines +142 to +143

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize null localized names before rendering the gallery

For a skin containing "names": null, check() reports no problems because its validation explicitly skips None, but meta.get("names", {}) returns None and sorted(others) raises TypeError. Since every command renders the gallery before dispatching, this prevents check, gallery, and pack from completing for an otherwise accepted skin. Normalize null to an empty mapping here, or reject it during validation with the existing diagnostic.

Useful? React with 👍 / 👎.

rows.append(f'| <img src="skins/{name}/idle.png" width="120" alt=""> | {title} | {author} | '
f"`{voice}` | [Download]({RELEASE}/{name}.plinthskin) |")
return "\n".join(rows)

Expand Down
Empty file removed skins/.gitkeep
Empty file.
Binary file added skins/abacus/hit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skins/abacus/idle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skins/abacus/impact.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skins/abacus/mallet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions skins/abacus/skin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "Abacus",
"names": { "zh-Hans": "算盘" },
"author": "Plinth",
"license": "CC0-1.0",
"strike": [0.5, 0.325],
"voice": "bead",
"glow": "#F0BA44"
}
Binary file added skins/crt-terminal/hit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skins/crt-terminal/idle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skins/crt-terminal/impact.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skins/crt-terminal/mallet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions skins/crt-terminal/skin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "CRT Terminal",
"names": { "zh-Hans": "CRT 终端" },
"author": "Plinth",
"license": "CC0-1.0",
"strike": [0.52, 0.395],
"voice": "crt"
}
Binary file added skins/mug/idle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skins/mug/impact.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skins/mug/mallet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions skins/mug/skin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "Mug",
"names": { "zh-Hans": "马克杯" },
"author": "Plinth",
"license": "CC0-1.0",
"strike": [0.56, 0.36],
"voice": "ceramic",
"glow": "#F6BE3D"
}
Binary file added skins/piston/hit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skins/piston/idle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skins/piston/impact.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skins/piston/mallet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions skins/piston/skin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "Piston",
"names": { "zh-Hans": "活塞" },
"author": "Plinth",
"license": "CC0-1.0",
"strike": [0.52, 0.39],
"voice": "piston"
}
Binary file added skins/seal/idle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skins/seal/impact.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skins/seal/mallet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions skins/seal/skin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "Seal",
"names": { "zh-Hans": "印章" },
"author": "Plinth",
"license": "CC0-1.0",
"strike": [0.55, 0.39],
"voice": "stamp",
"glow": "#F95240"
}
Binary file added skins/space-key/hit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skins/space-key/idle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skins/space-key/impact.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skins/space-key/mallet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions skins/space-key/skin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "Space Key",
"names": { "zh-Hans": "空格键" },
"author": "Plinth",
"license": "CC0-1.0",
"strike": [0.52, 0.515],
"voice": "key"
}
Loading