Skip to main content

A command line interface tool to generate pride flags from images.

Project description

pyflagoras

🏳️‍🌈 A Python command line interface tool to generate pride flags from images.

https://github.com/phthallo/pyflagoras/assets/84078890/5440a9d3-2c49-4200-a52a-f4896956ece0

Installation

You can install this package from pypi.org! Open a terminal and run the following:

pip install pyflagoras

Usage

$ pyflagoras --help
usage: pyflagoras [-h] [-f FLAG] [-n NAME] [--verbose] [--version] [-l] image

A command line interface tool to generate pride flags from images.

positional arguments:
  image                 Path to the image to generate a flag from.
                        Examples:
                            image.png
                            foo/bar/image.jpg

options:
  -h, --help            show this help message and exit
  -f FLAG, --flag FLAG  The ID (<flag_name>_<year_of_release>) of the flag to generate.
                        Examples:
                            intersexInclusive_2021
                            nonbinary_2014
                        Default:
                            progressPride_2018
  -n NAME, --name NAME  Customise the name of the final .svg. The following can be used as part of the file name:
                        Format placeholders:
                            {n}: File name (e.g celeste_classic)
                            {N}: File name (full) (e.g celeste_classic.png)
                            {f}: Flag name (e.g Progress Pride)
                            {F}: Flag ID (e.g progressPride_2018)
                        Examples:
                            pyflagoras celeste_classic.png -n "{f}_{n}" [renders Progress Pride_celeste_classic.svg]
                        Default:
                            {n}_{F} [renders celeste_classic_progressPride_2018.svg]

  --verbose             Enable verbosity (for general info and debugging)
  --version             show the program's version number and exit
  -l, --list            show all flag ids and exit

Documentation, issues and more: https://github.com/phthallo/pyflagoras

Development

Substitute py for python3 as necessary.

  1. Clone the repository.
    git clone https://github.com/phthallo/pyflagoras
    
  2. Install the build tool.
    py -m pip install --upgrade build
    
  3. cd to the root of the repository and build the package.
    py -m build
    
  4. Both the source distribution (pyflagoras-x.x.x-tar.gz) and the built distribution (pyflagoras-x.x.x-py3-none-any.whl) will be found under the /dist subdirectory. You can then install the wheel using:
    py -m pip install dist/pyflagoras-x.x.x-py3-none-any.whl
    

Adding other flags

The current pride flags are sourced from @/JoeHart's Pride Flag API.

To add a new flag, open a pull request with the file name <flag_name>_<year_of_release>.json. Make sure this .json file follows the format of the other flags under /src/pyflagoras/flags. At the very least, the file must contain the flag's name, its ID, and the flag in .svg format.

Notes

  • The name pyflagoras comes from python, pride flag, and the basic colour similarity algorithm being a 3D application of Pythagoras' theorem.
  • See also the prideflagbot account (gone but not forgotten!) run by @/michalpazur, which was a big inspiration for this project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyflagoras-0.3.2.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

pyflagoras-0.3.2-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file pyflagoras-0.3.2.tar.gz.

File metadata

  • Download URL: pyflagoras-0.3.2.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for pyflagoras-0.3.2.tar.gz
Algorithm Hash digest
SHA256 eea548631e8a9428740c4b4e510b9f02df0aba88ae6e9382df7f87e1b58cfda4
MD5 17630e9a8ca2d0980ffc2b6f2beeda31
BLAKE2b-256 cef04591b2014475b01025e89bb81f69a95b474f443f4b84f8aa23c425afb049

See more details on using hashes here.

File details

Details for the file pyflagoras-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: pyflagoras-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for pyflagoras-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 01610612d9e9b2b02c8ec1efb0993e6bcb3a7b72846c3e1b8505f664b9ddbea1
MD5 64be4ed0f3583fe7981b80770a9c1e61
BLAKE2b-256 837fcb96e15f61d2ed632d3f3463d63de5d34057e903130dd3405fb571eb11e3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page