Skip to content

Commit 0ac195c

Browse files
Add documentation for adding custom SVG icons with index.json update instructions
1 parent 94f55e0 commit 0ac195c

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,68 @@ http://localhost:3000
133133
- Select the preset you want to delete
134134
- Click the delete button (🗑️)
135135

136+
### Adding Custom SVG Icons
137+
138+
The application currently includes 549+ FontAwesome icons, but you can easily add your own custom SVG files:
139+
140+
1. **Add SVG Files:**
141+
- Place your SVG files in `public/icons/fontawesome/` directory
142+
- Use lowercase names with hyphens (e.g., `my-custom-icon.svg`)
143+
- Ensure SVGs have a `viewBox` attribute for proper scaling
144+
145+
2. **Update the Icon Index:**
146+
147+
**Option A: PowerShell (Windows)**
148+
```powershell
149+
Get-ChildItem public/icons/fontawesome/*.svg |
150+
Select-Object -ExpandProperty BaseName |
151+
Sort-Object |
152+
ConvertTo-Json |
153+
Set-Content public/icons/fontawesome/index.json
154+
```
155+
156+
**Option B: Bash (macOS/Linux)**
157+
```bash
158+
ls public/icons/fontawesome/*.svg |
159+
sed 's|.*/||;s|\.svg$||' |
160+
sort |
161+
jq -R -s -c 'split("\n")[:-1]' > public/icons/fontawesome/index.json
162+
```
163+
164+
**Option C: Node.js (Cross-platform)**
165+
```javascript
166+
const fs = require('fs');
167+
const path = require('path');
168+
169+
const iconDir = './public/icons/fontawesome';
170+
const icons = fs.readdirSync(iconDir)
171+
.filter(f => f.endsWith('.svg'))
172+
.map(f => path.basename(f, '.svg'))
173+
.sort();
174+
175+
fs.writeFileSync(
176+
path.join(iconDir, 'index.json'),
177+
JSON.stringify(icons, null, 2)
178+
);
179+
```
180+
181+
3. **Rebuild (if using build process):**
182+
```bash
183+
npm run build
184+
```
185+
186+
4. **Refresh the Application:**
187+
- Reload the page
188+
- Your custom icons will appear in the icon picker
189+
- They are searchable by filename
190+
191+
**SVG Tips:**
192+
- Keep file sizes small (< 10KB recommended)
193+
- Use single-color SVGs for best results with the color picker
194+
- Remove unnecessary metadata and comments
195+
- Ensure proper `viewBox` for consistent scaling
196+
- Use kebab-case naming (lowercase with hyphens)
197+
136198
## Keyboard Shortcuts
137199

138200
| Shortcut | Action |

0 commit comments

Comments
 (0)