A tool for generating Firefox brand folder content in all its variations from a smaller set of source assets. This generator processes brand configurations to produce complete branding packages for different Firefox distributions.
# List of all available commands
cargo run -- --help
# Example
cargo run -- ../config.json ../brands/official ../static -o ../dist-officialfirefox-brand-generator [OPTIONS] <CONFIG> <SOURCE> <STATIC_DIR>
CONFIG- Path to the configuration JSON fileSOURCE- Path to the brand-specific source folderSTATIC_DIR- Path to the static assets folder
-o, --output <DIR>- Path to the output/destination folder (default:dist)--mac <MODE>- Control macOS-specific transformationsnone- Skip all macOS-specific operationssimple- Runicns,assets-caronlyall- Runicns,assets-car,ds-store- If not specified, defaults to
simpleon macOS andnoneon other platforms
--only <TYPES>- Comma-separated list of transformation types to run- Available types:
raster,ico,icns,assets-car,copy,copy-preprocess,ds-store - When specified, only these types will be run and
--macis ignored
- Available types:
-h, --help- Print help information-V, --version- Print version information
The main configuration file defines a list of transformations that specify how source assets are processed into output files. Each transformation has a type field and specific arguments based on the transformation type.
Source files can come from two locations: a shared "static" folder containing assets used across all brands, or brand-specific "source" folders containing assets unique to each Firefox distribution.
-
raster- Converts vector graphics or images to raster formatsfileType: Source asset location ("source" or "static")inputPath: Source file pathoutputPath: Output file pathoutputFileType: Target format ("png", "jpg", "bmp", "tiff", "gif")width: Output width in pixelsheight: Output height in pixelspaddingPixelsWidth: Optional horizontal padding in pixelspaddingPixelsHeight: Optional vertical padding in pixelsoffsetX: Optional horizontal offset in pixelsoffsetY: Optional vertical offset in pixelsfit: Scaling strategy ("fill", "cover", "contain", "scale-down") - defaults to "contain"
-
ico- Creates Windows ICO files with multiple sizesfileType: Source asset location ("source" or "static")inputPath: Source file pathoutputPath: Output ICO file pathsizes: Array of icon sizes to include (e.g., [256, 48, 32, 16])
-
icns- Creates macOS ICNS files with multiple sizesfileType: Source asset location ("source" or "static")inputPath: Source file pathoutputPath: Output ICNS file pathsizes: Array of icon sizes to include (e.g., [1024, 512, 256, 128, 32, 16])
-
copy- Direct file copy without modificationfileType: Source asset location ("source" or "static")inputPath: Source file pathoutputPath: Destination file path
-
copy-preprocess- File copy with template variable substitutionfileType: Source asset location ("source" or "static")inputPath: Source file pathoutputPath: Destination file path
-
assets-car- Creates macOS Assets.car bundleliquidGlassIconFileType: Source asset location for liquid glass icon ("source" or "static")liquidGlassIconPath: Liquid glass icon pathoutputPath: Assets.car output pathappIconInput: Application icon source pathappIconFileType: Source asset location for app icon ("source" or "static")iconInput: Generic icon source pathiconFileType: Source asset location for icon ("source" or "static")
-
ds-store- Generates macOS .DS_Store files for disk imagesoutputPath: .DS_Store output pathappName*: Application name for the volumevolumeName*: Disk image volume namebackgroundImage: DMG background image pathbackgroundImageFileType: Source asset location for background ("source" or "static")volumeIcon: Volume icon file pathvolumeIconFileType: Source asset location for volume icon ("source" or "static")windowPosition*: DMG window position as "x y" (e.g., "200 120")windowSize*: DMG window size as "width height" (e.g., "680 400")appIconPosition*: App icon position as "x y" (e.g., "209 220")appDropLinkPosition*: Applications link position as "x y" (e.g., "472 220")
Note: Fields marked with an asterisk (*) support string substitution using template variables from the brand configuration.
Brand configurations are stored in brand-config.json files within each brand folder. They contain:
strings- Key-value pairs for template substitution (e.g., product names, version strings)env- Environment variables for build configuration
The copy-preprocess transformation supports template variable substitution and conditional logic:
{{#str key}}- Replaces with value fromstringsin brand config- Example:
{{#str brandName}}→Firefox
{{#if condition}}- Start conditional block{{#elseif condition}}- Alternative condition{{#else}}- Fallback block{{#endif}}- End conditional block
- Equality:
env == valueorenv != value - Logical AND:
condition1 && condition2 - Logical OR:
condition1 || condition2 - Parentheses:
(condition1 || condition2) && (condition3)
{{#if name != official && name != aurora}}
Official or aurora build content here
{{#elseif name == nightly}}
Nightly build content
{{#else}}
Other build content
{{#endif}}
These transformations require macOS-specific tools and only work on macOS systems:
-
ICNS Generation: Creates multi-resolution icon bundles using Apple's
iconutilcommand-line tool.The process generates a temporary
.iconsetdirectory with PNG files at various sizes (including @2x retina variants for standard sizes like 32, 64, 256, 512, 1024), then usesiconutil -c icnsto compile them into a single.icnsfile. -
Assets.car Creation: Generates compiled asset catalogs using Apple's
actool(Asset Catalog Tool).The process creates a temporary
.xcassetsbundle containingAppIcon.appiconset(with sizes 16-512px at 1x and 2x scales) andIcon.iconset(256px variants), along with a liquid glass icon template directory.actoolthen compiles these into an optimized.carfile. This file is specifically used on newer macOS versions for the App icon, particularly for rendering the liquid glass icon effect. -
DS_Store Generation: Creates properly formatted
.DS_Storefiles for disk images by generating a temporary DMG using thecreate-dmgscript, then extracting the.DS_Storefile from the mounted volume.The process includes setting background images with
sips(to adjust DPI), creating volume icons via ICNS generation, and positioning UI elements.