Skip to content

Commit e659947

Browse files
committed
add docs
1 parent cd94fd0 commit e659947

1 file changed

Lines changed: 75 additions & 0 deletions

File tree

content/docs/add-a-program.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Fill it in with the program's details:
5353
| `license` | No | Short license identifier (e.g. `MIT`, `GPL-2.0`) |
5454
| `categories` | Yes | Array of category slugs. Must match existing files in `content/categories/`. |
5555
| `package_names` | Yes | Map of distro slug → package name |
56+
| `logo` | No | Path to a 64×64 PNG logo (see below) |
5657

5758
## Package names
5859

@@ -78,6 +79,80 @@ Categories must already exist in `content/categories/`. Each file there is a JSO
7879
}
7980
```
8081

82+
## Adding a logo (optional)
83+
84+
A logo is displayed as a small 28×28 icon next to the program name in both the Programs catalog and the Setup Generator.
85+
86+
### File location
87+
88+
Place a **64×64 PNG** in the static folder, mirroring the program's content path:
89+
90+
```
91+
static/programs/htop/logo.png
92+
```
93+
94+
Then add the `logo` field to `program.json`:
95+
96+
```json
97+
{
98+
"name": "htop",
99+
"slug": "htop",
100+
"logo": "/programs/htop/logo.png",
101+
...
102+
}
103+
```
104+
105+
### Finding a logo
106+
107+
The best source for clean, consistent logos is [simple-icons](https://simpleicons.org/) — a free library of SVG brand icons. Search for the program name there first.
108+
109+
If the program is not in simple-icons, check:
110+
- The program's GitHub repository (look for a logo in `README.md`, `.github/`, or `docs/`)
111+
- The program's official website favicon
112+
113+
### Converting an SVG to PNG
114+
115+
Use `rsvg-convert` to render the SVG at 64×64. The snippet below wraps the icon in a light rounded background with the brand color, which matches the style used by all existing logos:
116+
117+
```bash
118+
python3 - input.svg "#HEXCOLOR" static/programs/htop/logo.png << 'EOF'
119+
import sys, re, subprocess, os
120+
121+
svg_path, color, out_path = sys.argv[1], sys.argv[2], sys.argv[3]
122+
with open(svg_path) as f:
123+
content = f.read()
124+
125+
vb = re.search(r'viewBox="([^"]+)"', content)
126+
vb_vals = [float(x) for x in vb.group(1).split()] if vb else [0, 0, 24, 24]
127+
src_w, src_h = vb_vals[2], vb_vals[3]
128+
129+
inner = re.sub(r'<\?xml[^>]*\?>', '', content)
130+
inner = re.sub(r'<svg[^>]*>', '', inner, count=1)
131+
inner = re.sub(r'</svg>\s*$', '', inner.strip()).strip()
132+
133+
pad, icon_size = 8, 48
134+
scale = icon_size / max(src_w, src_h)
135+
136+
wrapped = f"""<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
137+
<rect width="64" height="64" rx="10" fill="#f8f9fa"/>
138+
<g fill="{color}" transform="translate({pad},{pad}) scale({scale})">
139+
{inner}
140+
</g>
141+
</svg>"""
142+
143+
tmp = svg_path + '.tmp.svg'
144+
with open(tmp, 'w') as f: f.write(wrapped)
145+
subprocess.run(['rsvg-convert', '-w', '64', '-h', '64', tmp, '-o', out_path], check=True)
146+
os.remove(tmp)
147+
EOF
148+
```
149+
150+
Replace `#HEXCOLOR` with the program's brand color (found on the simple-icons page next to the icon).
151+
152+
### Programs without a logo
153+
154+
The `logo` field is entirely optional. Programs without one simply display their name without an icon — no placeholder or broken image is shown.
155+
81156
## Step 3 — Test locally
82157

83158
```bash

0 commit comments

Comments
 (0)