Skip to main content

A simple output styler in Python

Project description

How to use

Requirements

  • Python 3.6 or more
  • Windows*

How to use

First install with pip

pip install styleio

Now import

import styleio

Now style that IO!

First, you need to think about how your IO will look like. You can have text styled. Just simply enter one of bold, dim, italic, underline, blink, inverse, hidden, or strikethrough

Now, color your text. Color is optional, but you have four color mode choices: rgb**, 256 colors**, 16 colors, and bright colors***

*I have not tested on an operating system without windows, feel free to open an issue with the readme saying otherwise on github **RGB and 256 color modes do NOT support styled text ***Only terminals that support the aixterm specification (mine did) support brightcolors

If you have rgb colors, the mode will be 'rgb' and the color will be a tuple of (r, g, b), where 0 <= r, g, b, <= 255, and the mode will be 'rgb' If you have 256 colors, the mode will be 'colors256' and the color will be an id 0 <= id <= 255, where each id means these colors: 0-7: standard colors (as in ESC [ 30–37 m) 8–15: high intensity colors (as in ESC [ 90–97 m) 16-231: 6 × 6 × 6 cube (216 colors): 16 + 36 × r + 6 × g + b (0 ≤ r, g, b ≤ 5). Some interpret these as constant increments, while others have specific values for each one 232-255: grayscale from dark to light in 24 steps.

With 16 colors (normal, recommended), the mode will be 'colors16', and color will be one of 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default' Bright colors are just like 16 colors, its just that they will look brighter on the terminal and the mode is 'brightcolors'

Styling the IO

First, specify the list of styles

graphics = ['bold', 'italic']

Next, specify the color. Say I want bright red

color = 'red'
mode = 'brightcolors'

Now, finally style the output

string = style(
    graphics=graphics,
    color=color,
    mode=mode
)
print(string)

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

styleio-0.0.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

styleio-0.0.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file styleio-0.0.1.tar.gz.

File metadata

  • Download URL: styleio-0.0.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for styleio-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5c4dc46fecef757d50ac3d46eeb8db563062be7b7f19b027485fc939595075bb
MD5 2b2de32c1650c0099d880d9d95af8a20
BLAKE2b-256 9b5f974b62699537bfddefa41f9df66e48a318c28f95b165ee09ec00d3dd3c75

See more details on using hashes here.

File details

Details for the file styleio-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: styleio-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for styleio-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d8b4b2edc869ecb615a056af762ac4e8f9cfafd6cbc66e1dc2e531c4794711af
MD5 e73fbf233d02437b035c108a797bb402
BLAKE2b-256 1f9e200f27eb0571aad1a60ee4bc7545ca6755e200ed8e7fa1ff91565d67b04f

See more details on using hashes here.

Supported by

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