kennethreitz / crayons

Text UI colors for Python.
https://pypi.python.org/pypi/crayons
MIT License
423 stars 30 forks source link

Padding strings won't work with colored strings. #8

Closed alephmelo closed 5 years ago

alephmelo commented 7 years ago

Hey there, @kennethreitz!

I was hacking around a new cli-tool with some cool colored strings with crayons but I needed to make customization on formatting and ran into this issue.

capture

The second attempt is using colorama's own API and worked as expected. I also tried using string interpolation like %-5s and it didn't work.

Anyways, if point me out to where this issue is happening I'll gladly try to solve this and send a PR.

Thanks for the great work. :beer:

Cheers from Brazil.

kathawala commented 6 years ago

@alephmelo I think this should work for you for now. I can try to work on a fix in the next few days.

import crayons
string = 'testing'
for letter in string:
    print crayons.red('{:5}'.format(letter)),

screenshot_20171021_040544

ParthS007 commented 5 years ago

Closing due to inactivity :+1: