Code Monkey home page Code Monkey logo

minicode's Introduction

MIT License

Minicode

Generate minimalist code art
Report Bug · Request Feature

Table of Contents

About The Project

Screenshot

Minicode is a minimalist code image generator. It allows you to create PNG or SVG images from existing code. It is based on the Pygments library which allows to detect color syntax information specific to each programming language.

This project is inspired by the work of erdavids.

Most of the variables used to generate the SVG file can be overload (more information in the Usage section).-->

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Installation

  1. Clone the repo
git clone https://github.com/Gokender/minicode.git
  1. Install PIP packages
pip install -r requirements.txt

Usage

To generate a new minimal code :

>> python minicode\cli.py
Saving file : minicode.svg

>> python minicode\cli.py --input this\is\an\example.py --output exemples\myfile
Saving file : exemples\myfile.svg

If you want to choose another language from Python (HTML for example):

>> python minicode\cli.py --lexer html
Saving file : minicode.svg

To choose a different theme :

>> python minicode\cli.py --theme monokai
Saving file : minicode.svg

The currently available themes are :

  • default
  • dracula
  • fruity
  • monokai

You can generate an image from an url. This option will override the input file variable. The --auto_size arg choose for you the best width and height.

>> python minicode\cli.py --url https://raw.githubusercontent.com/dead-beef/markovchain/master/markovchain/parser.py -a
Saving file : minicode.svg

If --png is set the output will be PNG image instead of SVG.

>> python minicode\cli.py --url https://raw.githubusercontent.com/dead-beef/markovchain/master/markovchain/parser.py -a --png
Saving file : minicode.png

If you don't want to change the variable one by one you can update the default configuration file config.ini

Below the list of all variables you can change :

python minicode\cli.py --help
usage: cli.py [-h] [--width WIDTH] [--height HEIGHT] [--theme THEME]
              [--input INPUT] [--output OUTPUT] [--code_width CODE_WIDTH]
              [--code_height CODE_HEIGHT] [--start_position START_POSITION]
              [--radius_rect RADIUS_RECT] [--line_spacing LINE_SPACING] [-a]
              [--lexer LEXER] [--url URL] [--png]

optional arguments:
  -h, --help            show this help message and exit
  --width WIDTH         SVG width
  --height HEIGHT       SVG height
  --theme THEME         Syntax highlighting theme
  --input INPUT         Input filepath
  --output OUTPUT       Output filepath
  --code_width CODE_WIDTH
                        Width in pixel of character
  --code_height CODE_HEIGHT
                        Height in pixel of character
  --start_position START_POSITION
                        Starting pixel position
  --radius_rect RADIUS_RECT
                        Radius for rounded corner
  --line_spacing LINE_SPACING
                        Line spacing
  -a, --auto_size       Choose width & height for you
  --lexer LEXER         Code parser
  --url URL             Url to download
  --png                 Saving image in PNG

Examples

default

default

fruity

fruity

monokai

monokai

Roadmap

See the open issues for a list of proposed features (and known issues).

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Gauthier Chaty - @gokender

Project Link: Minicode

Acknowledgements

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.