Skip to content

DeviesDevelopment/whitelabel_asset_gen

Repository files navigation

Flutter Custom Icon Generator

🎨 An interactive tool for creating custom brand icons for Flutter Flavorizr projects.

Features

  • Interactive Setup: Step-by-step guided configuration
  • Brand-Specific Icons: Generate unique icons for each app flavor
  • Multi-Platform Support: Creates icons for Android, iOS, and macOS
  • Automatic Integration: Updates flavorizr.yaml and runs flavorizr automatically
  • Generic & Reusable: Works with any brand colors and styles

Quick Start

  1. Navigate to your Flutter project (must have flavorizr configured)
  2. Run the automation script:
    cd custom-icon-tool
    python3 automate_icons.py

Non-Interactive (Recommended)

If you already have a config JSON, you can run without prompts:

cd custom-icon-tool
python automate_icons.py --config brand_config.json

Or use the wrapper, which auto-detects brand_config.json:

bash run.sh
  1. Follow the prompts to configure your brands
  2. Watch the magic happen ✨

What This Tool Does

1. Brand Configuration

  • Prompts for brand names, colors, and icon styles
  • Supports multiple brands in one session
  • Validates input (hex colors, flavor names)

2. Icon Generation

  • Creates PNG icons in all required sizes:
    • Android: 5 density buckets (mdpi to xxxhdpi)
    • iOS/macOS: 7 sizes (16px to 1024px)
  • Generates brand-specific designs based on:
    • Colors (primary, secondary, accent)
    • Icon style (circle, tag, square)
    • Brand name and symbol

3. Flavorizr Integration

  • Updates flavorizr.yaml with new brand configurations
  • Copies icons to expected paths
  • Runs dart run flutter_flavorizr automatically

Supported Icon Styles

Circle Style (Default)

  • Circular background with inner design elements
  • Cooperative/community themed design
  • Best for professional brands

Tag Style

  • Price tag design with fold
  • Dollar sign or custom symbol
  • Perfect for retail/discount brands

Square Style

  • Square background with inner square
  • Clean, modern look
  • Great for tech brands

Configuration Options

Each brand can be configured with:

{
  "flavor_name": {
    "name": "Brand Display Name",
    "primary_color": "#RRGGBB",
    "secondary_color": "#RRGGBB",
    "accent_color": "#RRGGBB",
    "icon_style": "circle|tag|square",
    "symbol": "Single character or symbol"
  }
}

Manual Usage

Generate Icons Only

python3 generate_icons.py [config_file.json]

If config_file.json is relative, it resolves from the tool directory; all outputs are written under the project root assets/icons/....

Create Config Manually

  1. Copy brand_config.json.example to brand_config.json
  2. Edit the JSON with your brand settings
  3. Run python3 generate_icons.py

File Structure

custom-icon-tool/
β”œβ”€β”€ automate_icons.py      # Interactive automation script
β”œβ”€β”€ generate_icons.py      # Icon generation engine
β”œβ”€β”€ README.md             # This documentation
└── brand_config.json.example  # Example configuration

Generated icons appear in:
assets/icons/{flavor_name}/
β”œβ”€β”€ android/mipmap-{density}/ic_launcher.png
β”œβ”€β”€ ios_icon_{size}.png
β”œβ”€β”€ macos_icon_{size}.png
└── {ic_launcher,ios_icon,macos_icon}.png

Requirements

  • Python 3.6+ with PIL/Pillow
  • Flutter project with flavorizr configured
  • flavorizr.yaml and pubspec.yaml in project root

Customization

Modify Icon Designs

Edit the create_brand_icon() function in generate_icons.py:

def create_brand_icon(size, brand_config):
    # Your custom drawing logic here
    # Use: primary_color, secondary_color, accent_color
    # Use: brand_config['name'], brand_config['symbol']
    # Use: brand_config['icon_style']
    pass

Add New Icon Styles

  1. Add style option to the switch statement
  2. Implement your custom design logic
  3. Update this README

Color Schemes

  • Primary: Main background color
  • Secondary: Inner elements/highlights
  • Accent: Text and contrast elements

Troubleshooting

Common Issues

"Missing required files"

  • Ensure you're in a Flutter project directory
  • Check for flavorizr.yaml and pubspec.yaml

"Icon generation failed"

  • Verify Python PIL/Pillow is installed: pip install Pillow
  • Check that brand colors are valid hex format

"Flavorizr execution failed"

  • Run dart run flutter_flavorizr manually to see detailed errors
  • Ensure you have internet connection for asset downloads

Manual Recovery

If automation fails partway through:

  1. Fix the issue (missing dependencies, invalid config, etc.)
  2. Run generation only: python3 generate_icons.py
  3. Run flavorizr manually: dart run flutter_flavorizr

Examples

Retail Brand (Tag Style)

{
  "primary_color": "#E30613",
  "secondary_color": "#FF0000",
  "accent_color": "#FFFFFF",
  "icon_style": "tag",
  "symbol": "$"
}

Professional Brand (Circle Style)

{
  "primary_color": "#009639",
  "secondary_color": "#00A651",
  "accent_color": "#FFFFFF",
  "icon_style": "circle",
  "symbol": "P"
}

Tech Brand (Square Style)

{
  "primary_color": "#3F51B5",
  "secondary_color": "#2196F3",
  "accent_color": "#FFFFFF",
  "icon_style": "square",
  "symbol": "T"
}

Contributing

  1. Fork the repository
  2. Add new icon styles or features
  3. Update documentation
  4. Submit a pull request

License

This tool is provided as-is for Flutter development. Feel free to modify and distribute.


Happy icon generating! 🎨✨

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published