tehmaze / ansi Goto Github PK
View Code? Open in Web Editor NEWANSI cursor movement and graphics in Python
Home Page: https://pypi.org/project/ansi/
License: MIT License
ANSI cursor movement and graphics in Python
Home Page: https://pypi.org/project/ansi/
License: MIT License
ansi.col uses ansi.sequence incorrectly
return sequence('m')(38, 5, colour)
import ansi.colour.rgb
ansi.colour.rgb.rgb256(1,1,1)
Traceback (most recent call last):
File "", line 1, in
File "/home/[REDACTED]/bin/ansi-master/ansi/colour/rgb.py", line 65, in rgb256
return sequence('m')(38, 5, colour)
File "/home/[REDACTED]/bin/ansi-master/ansi/sequence.py", line 9, in _sequence
(len(output), fields))
ValueError: Invalid number of fields, got 3 expected 1
You need
return sequence('m', 3)(38, 5, colour)
ansi.colour.rgb.rgb256(1,1,1)
'\x1b[38;5;232m'
I see in git tree tox.ini which uses pytest however when I'm trying to use pytest it ends with non-zero exit code because it cannot find any units.
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-ansi-0.2.0-2.1.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-ansi-0.2.0-2.1.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra ansi
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
Using --randomly-seed=3347195379
rootdir: /home/tkloczko/rpmbuild/BUILD/ansi-0.2.0
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, aspectlib-1.5.2, toolbox-0.5, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, xprocess-0.18.1, black-0.3.12, anyio-3.3.0, asyncio-0.15.1, trio-0.7.0, subtests-0.5.0, isort-2.0.0, hypothesis-6.14.6, mock-3.6.1, profiling-1.7.0, randomly-3.8.0, Faker-8.12.1, nose2pytest-1.0.8, pyfakefs-4.5.1, tornado-0.8.1, twisted-1.13.3
collected 0 items
========================================================================== no tests ran in 0.14s ===========================================================================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.
Hi!
Presently cursor.erase() does not work.
The statement:
erase = sequence('J')
in cursor.py should be changed to:
erase = sequence('2J')
Thanks!
No license is mentioned in the README, nor source, nor trove classifiers, as there are none. Please include a license.
I believe high-intensity colors (codes 90โ97 and 100โ107) were left out of the package under the assumption that they could be created with the addition of the bold (1) ANSI code.
While the Wikipedia page for ANSI code '1' does indicate "Bold or increased intensity", it doesn't actually have the same effect as selecting the intense flavor of colors. Code 1 does result in a brighter color, but it also results in bold text in the case of some characters (perhaps depending on the font). Using the high-intensity versions of the color results in the color being brighter but without the bold effect.
The attached picture demonstrates the difference for both foreground and background colors. There isn't a difference in the text color between lines 2 and 3, but you can see the horizontal box-drawing ('\u2500') is thicker. The difference is most apparent in the background versions where lines 5 and 6 share neither the foreground color, background color, nor the horizontal thickness.
See: https://pypi.org/project/ansi/
In particular reset
has moved from ansi.colour
to ansi.colour.fx
.
The library has a very nice API, but it is missing type information.
Is this to enable compatibility with python 2? Otherwise I would be happy to contribute some annotations.
Hey,
it would be cool to release the current master because a license was added which would enable me to package ansi for fedora.
What is the canonical way of installing v0.3.0? The command pip install ansi
will just install an ansi-0.3.0.dist-info
directory.
hi!
Adding a switch to rgb256(r,g,b, bg=True)
you could return
if bg:
return sequence('m', fields=3)(48, 5, colour)
else:
return sequence('m', fields=3)(38, 5, colour)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.