Skip to content

libsrcdev/pixelarticons

Repository files navigation

Pixel Art Icons package for Flutter

This package provides a set of pixel art icons as font for Flutter, it can be used in the same way we use Icons class.

Icon set created by @halfmage, if you like this free icon set you will also like the premium ones.

Show preview

Pixelarticons - Frame Pixelarticons - Frame

Install the package

You can check the latest version on pub.dev/pixelarticons.

dependencies:
  # ...
  pixelarticons: <latest-version>
  # ...

or run:

flutter pub add pixelarticons

Import the package

Import wherever you want:

import 'package:pixelarticons/pixelarticons.dart';

Use as IconData

pixelarticons package uses the IconData class, so the usage is pretty much the same of the Icons class but renamed to Pixel.

Be aware:

  • Lower-case for all icons and no separators, for example card-plus is written as Pixel.cardplus.
  • Icons that starts with non-alpha characters, like 4k, 4k-box, 4g are prefixed with k.
  • Icons that are Dart keywords, like switch are prefix with k as well.

So use k4k, k4kbox, kswitch instead.

Icon full list https://pixelarticons.com/free/.

/// 4k icon:
Icon(Pixel.k4k)

/// switch icon:
Icon(Pixel.kswitch)

/// align-left icon:
Icon(Pixel.alignleft);

How it works

This library automatically syncs with the pixelarticons repository, generates a font, and publishes to pub.dev.

Automation tool

All automation lives in tool/, a standalone Dart CLI:

# Check for upstream changes (dry run)
dart run tool/bin/pixelarticons_tool.dart --dry-run

# Download and process SVGs
dart run tool/bin/pixelarticons_tool.dart

# Force re-download even if up to date
dart run tool/bin/pixelarticons_tool.dart --no-cache

The tool:

  1. Fetches the latest commit hash from halfmage/pixelarticons master branch
  2. Compares it with the pixelarticons_commit key in pubspec.yaml
  3. If there's a new commit: downloads the repo zipball, extracts SVGs, applies Dart naming conventions (prefixing keywords and numeric names with k), and places them in release/svg/
  4. Bumps the package version and updates CHANGELOG.md

Font generation

After the tool runs, fontify generates the icon font and Dart class from the SVGs:

dart pub global activate fontify
dart pub global run fontify

This reads from release/svg/ and generates:

  • fonts/pixelarticons.otf — the icon font
  • lib/pixel.dart — the Dart class with IconData constants

The fontify configuration is in pubspec.yaml under the fontify: key.

CI/CD

Two GitHub Actions workflows handle the automation:

  • publish.yml — runs on cron (1st and 15th of each month) or manual dispatch. Checks for upstream changes, downloads SVGs, generates the font, commits, and pushes a version tag.
  • release.yml — triggered by the version tag push, publishes to pub.dev using OIDC automated publishing.

Run locally

Required: Dart SDK (>= 3.0.0) and Flutter SDK.

# Install tool dependencies
cd tool && dart pub get && cd ..

# Run the tool
dart run tool/bin/pixelarticons_tool.dart --no-cache

# Generate font
dart pub global activate fontify
dart pub global run fontify

# Format
dart format .

Run tests

cd tool && dart pub get && dart test

Contribute

Use the issues tab to discuss new features and bug reports.

About

Pixel Art Icons made simple for Flutter, powered by pixelarticons and fontify.

Topics

Resources

License

Stars

Watchers

Forks

Contributors