项目作者: cyberboysumanjay

项目描述 :
Unofficial API for generating beautiful images of your source code using Carbon.
高级语言: Python
项目地址: git://github.com/cyberboysumanjay/Carbon-API.git
创建时间: 2020-05-28T18:49:01Z
项目社区:https://github.com/cyberboysumanjay/Carbon-API

开源协议:GNU Lesser General Public License v3.0

下载


Carbon API [Unofficial]




Carbon



Unofficial API


Show some :heart: and :star: the repo

GitHub stars
GitHub followers
Telegram Channel

Carbon API written in Python using Flask and Pyppeteer

made-with-python Open Source Love svg1

Carbon makes it easy to create and share beautiful images of your source code

Usage

You can use the API by sending a GET or a POST request using these params

parameter default type description
code (required) string Code snippet
backgroundColor "rgba(171, 184, 195, 1)" string Hex or rgba color
dropShadow true boolean Turn on/off shadow
dropShadowBlurRadius "68px" string shadow blur radius
dropShadowOffsetY "20px" string shadow offset y
exportSize "2x" string resolution of exported image, e.g. 1x, 3x
fontSize "14px" string font size
fontFamily "Hack" string font family, e.g. JetBrains Mono, Fira Code.
firstLineNumber 1 number first line number
language "auto" string programing language for properly highlighting
lineNumbers false boolean turn on/off line number
paddingHorizontal "56px" string horizontal padding
paddingVertical "56px" string vertical padding
theme "seti" string code theme
watermark false boolean turn on/off watermark
widthAdjustment true boolean turn on/off width adjustment
windowControls true boolean turn on/off window controls
windowTheme "none" string window theme

GET /

Params are encoded in url

  1. https://carbonnowsh.herokuapp.com/?code=Made+with+Love+in+India+by+Sumanjay&theme=darcula&backgroundColor=rgba(144, 19, 254, 100)

POST /

Body is JSON with these params:

  1. {
  2. "backgroundColor": "rgba(144, 19, 254, 100)",
  3. "code": "Made with Love in India by Sumanjay",
  4. "theme": "dracula"
  5. }

RESPONSE

Response is an image of a code or text snippet.



Response

Deploy Option

  • Heroku Method
    Deploy

  • Other Method

    1. # Clone the repo
    2. git clone https://github.com/cyberboysumanjay/Carbon-API
    3. cd Carbon-API
    4. # Create virtualenv
    5. virtualenv -p /usr/bin/python3 venv
    6. ../venv/bin/activate
    7. # Install requirements
    8. pip3 install -r requirements.txt
    9. # Finally run the app
    10. python3 app.py

    Made with ❤️️ in India

  • Copyright (C) 2020 by Sumanjay

  • Licensed under the terms of the GNU GPL Version 3