fleet/tools/software/icons/README.md

38 lines
1.8 KiB
Markdown
Raw Normal View History

2025-07-18 19:58:45 +00:00
# Creating Icons for Fleet-maintained Apps
App icons for the Fleet server and [fleetdm.com software catalog](https://fleetdm.com/software-catalog) can be generated using the following script on macOS using an associated `.app` bundle.
## Usage
```bash
Support direct path to images in generate-icons script (#36946) This pull request adds support for generating app icons from a PNG file in addition to the existing `.app` bundle method. The changes update both the documentation and the `generate-icons.sh` script to allow users to specify either an app bundle or a PNG file, improving flexibility for icon generation. **Documentation and usage improvements:** * Updated `README.md` to document the new `-i` option for PNG input, clarified required arguments, and added usage examples for both `.app` bundles and PNG files. **Script enhancements for PNG support:** * Modified argument parsing in `generate-icons.sh` to accept a new `-i` option for PNG files, and added validation to ensure either `-a` or `-i` is provided (but not both). [[1]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44R295-R302) [[2]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L312-R381) * Added logic to handle PNG input: verifies the PNG file, derives component and display names from the slug, and integrates PNG processing alongside the existing `.app` bundle workflow. [[1]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L312-R381) [[2]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L412) [[3]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44R508-R519) * Adjusted SVG and component name generation to work appropriately for both input methods, ensuring correct naming and file output. [[1]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L465-R548) [[2]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L481-L483) [[3]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L501-L507)
2025-12-09 03:15:08 +00:00
bash tools/software/icons/generate-icons.sh -s slug-name [-a /path/to/App.app | -i /path/to/icon.png]
2025-07-18 19:58:45 +00:00
```
Support direct path to images in generate-icons script (#36946) This pull request adds support for generating app icons from a PNG file in addition to the existing `.app` bundle method. The changes update both the documentation and the `generate-icons.sh` script to allow users to specify either an app bundle or a PNG file, improving flexibility for icon generation. **Documentation and usage improvements:** * Updated `README.md` to document the new `-i` option for PNG input, clarified required arguments, and added usage examples for both `.app` bundles and PNG files. **Script enhancements for PNG support:** * Modified argument parsing in `generate-icons.sh` to accept a new `-i` option for PNG files, and added validation to ensure either `-a` or `-i` is provided (but not both). [[1]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44R295-R302) [[2]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L312-R381) * Added logic to handle PNG input: verifies the PNG file, derives component and display names from the slug, and integrates PNG processing alongside the existing `.app` bundle workflow. [[1]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L312-R381) [[2]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L412) [[3]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44R508-R519) * Adjusted SVG and component name generation to work appropriately for both input methods, ensuring correct naming and file output. [[1]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L465-R548) [[2]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L481-L483) [[3]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L501-L507)
2025-12-09 03:15:08 +00:00
- `-s`: Slug name for the Fleet-maintained app (required). The portion before the slash will be used in the output filenames.
- `-a`: Path to the `.app` bundle (e.g. `/Applications/Safari.app`). Required if `-i` is not provided.
- `-i`: Path to a PNG icon file. Required if `-a` is not provided. The icon will be resized to 128x128 if larger.
2025-07-18 19:58:45 +00:00
Support direct path to images in generate-icons script (#36946) This pull request adds support for generating app icons from a PNG file in addition to the existing `.app` bundle method. The changes update both the documentation and the `generate-icons.sh` script to allow users to specify either an app bundle or a PNG file, improving flexibility for icon generation. **Documentation and usage improvements:** * Updated `README.md` to document the new `-i` option for PNG input, clarified required arguments, and added usage examples for both `.app` bundles and PNG files. **Script enhancements for PNG support:** * Modified argument parsing in `generate-icons.sh` to accept a new `-i` option for PNG files, and added validation to ensure either `-a` or `-i` is provided (but not both). [[1]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44R295-R302) [[2]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L312-R381) * Added logic to handle PNG input: verifies the PNG file, derives component and display names from the slug, and integrates PNG processing alongside the existing `.app` bundle workflow. [[1]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L312-R381) [[2]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L412) [[3]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44R508-R519) * Adjusted SVG and component name generation to work appropriately for both input methods, ensuring correct naming and file output. [[1]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L465-R548) [[2]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L481-L483) [[3]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L501-L507)
2025-12-09 03:15:08 +00:00
## Examples
2025-07-18 19:58:45 +00:00
Support direct path to images in generate-icons script (#36946) This pull request adds support for generating app icons from a PNG file in addition to the existing `.app` bundle method. The changes update both the documentation and the `generate-icons.sh` script to allow users to specify either an app bundle or a PNG file, improving flexibility for icon generation. **Documentation and usage improvements:** * Updated `README.md` to document the new `-i` option for PNG input, clarified required arguments, and added usage examples for both `.app` bundles and PNG files. **Script enhancements for PNG support:** * Modified argument parsing in `generate-icons.sh` to accept a new `-i` option for PNG files, and added validation to ensure either `-a` or `-i` is provided (but not both). [[1]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44R295-R302) [[2]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L312-R381) * Added logic to handle PNG input: verifies the PNG file, derives component and display names from the slug, and integrates PNG processing alongside the existing `.app` bundle workflow. [[1]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L312-R381) [[2]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L412) [[3]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44R508-R519) * Adjusted SVG and component name generation to work appropriately for both input methods, ensuring correct naming and file output. [[1]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L465-R548) [[2]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L481-L483) [[3]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L501-L507)
2025-12-09 03:15:08 +00:00
Using an app bundle:
2025-07-18 19:58:45 +00:00
```bash
bash tools/software/icons/generate-icons.sh -a /Applications/Google\ Chrome.app -s "google-chrome/darwin"
```
Support direct path to images in generate-icons script (#36946) This pull request adds support for generating app icons from a PNG file in addition to the existing `.app` bundle method. The changes update both the documentation and the `generate-icons.sh` script to allow users to specify either an app bundle or a PNG file, improving flexibility for icon generation. **Documentation and usage improvements:** * Updated `README.md` to document the new `-i` option for PNG input, clarified required arguments, and added usage examples for both `.app` bundles and PNG files. **Script enhancements for PNG support:** * Modified argument parsing in `generate-icons.sh` to accept a new `-i` option for PNG files, and added validation to ensure either `-a` or `-i` is provided (but not both). [[1]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44R295-R302) [[2]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L312-R381) * Added logic to handle PNG input: verifies the PNG file, derives component and display names from the slug, and integrates PNG processing alongside the existing `.app` bundle workflow. [[1]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L312-R381) [[2]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L412) [[3]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44R508-R519) * Adjusted SVG and component name generation to work appropriately for both input methods, ensuring correct naming and file output. [[1]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L465-R548) [[2]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L481-L483) [[3]](diffhunk://#diff-3efaab61495d01f6ff77a1e75195bd8b009e71c9ea53e3278274cb5edf929c44L501-L507)
2025-12-09 03:15:08 +00:00
Using a PNG file directly:
```bash
bash tools/software/icons/generate-icons.sh -i /path/to/icon.png -s "company-portal/windows"
```
2025-07-18 19:58:45 +00:00
This will generate two files:
- `frontend/pages/SoftwarePage/components/icons/GoogleChrome.tsx` the SVG React component
- `website/assets/images/app-icon-google-chrome-60x60@2x.png` the 128x128 PNG used on the website
## Notes
- The SVG generated is embedded with a base64-encoded 32×32 version of the app's 128×128 PNG icon.
- The TSX component name is derived from the app's name (e.g. `Google Chrome.app``GoogleChrome.tsx`).
2025-07-18 19:58:45 +00:00
- The script ensures consistent formatting and naming conventions across icon components.
- **The script automatically adds the import statement and map entry to `frontend/pages/SoftwarePage/components/icons/index.ts`**, so you don't need to manually update the index file. The app name used in the map is extracted from the app's `Info.plist` (`CFBundleName` or `CFBundleDisplayName`).