pax_global_header 0000666 0000000 0000000 00000000064 14734264226 0014524 g ustar 00root root 0000000 0000000 52 comment=24f927faf9484d66a754cd2f931fa986d779dd00
tcolorpy-0.1.7/ 0000775 0000000 0000000 00000000000 14734264226 0013404 5 ustar 00root root 0000000 0000000 tcolorpy-0.1.7/.github/ 0000775 0000000 0000000 00000000000 14734264226 0014744 5 ustar 00root root 0000000 0000000 tcolorpy-0.1.7/.github/dependabot.yml 0000664 0000000 0000000 00000000250 14734264226 0017571 0 ustar 00root root 0000000 0000000 version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
actions-dependencies:
patterns: ["*"]
tcolorpy-0.1.7/.github/workflows/ 0000775 0000000 0000000 00000000000 14734264226 0017001 5 ustar 00root root 0000000 0000000 tcolorpy-0.1.7/.github/workflows/ci.yml 0000664 0000000 0000000 00000005310 14734264226 0020116 0 ustar 00root root 0000000 0000000 name: CI
on:
push:
branches:
- master
paths-ignore:
- ".gitignore"
- "README.rst"
- "ss/*"
pull_request:
paths-ignore:
- ".gitignore"
- "README.rst"
- "ss/*"
permissions:
contents: read
jobs:
build-package:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref_name }}-build
cancel-in-progress: true
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: |
setup.py
**/*requirements.txt
tox.ini
- run: make setup-ci
- run: make build
- uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist/*
lint:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref_name }}-lint
cancel-in-progress: true
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: |
setup.py
**/*requirements.txt
tox.ini
- run: make setup-ci
- run: make check
unit-test:
runs-on: ${{ matrix.os }}
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-unit-test-${{ matrix.os }}-${{ matrix.python-version }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10"]
os: [ubuntu-latest, macos-latest, windows-latest]
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
setup.py
**/*requirements.txt
tox.ini
- run: make setup-ci
- name: Run tests
run: tox -e cov
env:
PYTEST_DISCORD_WEBHOOK: ${{ secrets.PYTEST_DISCORD_WEBHOOK }}
- name: Upload coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
run: |
python -m pip install --upgrade --disable-pip-version-check coveralls tomli
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tcolorpy-0.1.7/.github/workflows/on_push_default_branch.yml 0000664 0000000 0000000 00000004404 14734264226 0024222 0 ustar 00root root 0000000 0000000 name: Publish to TestPyPI and Sign with Sigstore
on:
push:
branches:
- master
paths-ignore:
- ".gitignore"
- "README.rst"
permissions:
contents: read
jobs:
build-wheel-package:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref_name }}-build
cancel-in-progress: true
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: pip
cache-dependency-path: |
setup.py
**/*requirements.txt
tox.ini
- run: make setup-ci
- run: make build
- uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist/*
publish-package:
needs: build-wheel-package
runs-on: ubuntu-latest
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref_name }}-publish-pkg
cancel-in-progress: true
timeout-minutes: 10
environment:
name: testpypi
url: https://test.pypi.org/p/tcolorpy
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: ./dist
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
sign-package:
needs: publish-package
runs-on: ubuntu-latest
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref_name }}-sign-pkg
cancel-in-progress: true
timeout-minutes: 10
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: ./dist
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- uses: actions/upload-artifact@v4
with:
name: sigstore
path: ./dist/*
tcolorpy-0.1.7/.github/workflows/release.yml 0000664 0000000 0000000 00000003273 14734264226 0021151 0 ustar 00root root 0000000 0000000 name: Build and publish the new version to PyPI
on:
push:
tags:
- "v*.*.*"
permissions:
contents: read
jobs:
build-package:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: |
setup.py
**/*requirements.txt
tox.ini
- run: make setup-ci
- run: make build
- uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist/*
publish-package:
needs: build-package
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/tcolorpy
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: ./dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
generate-relese:
needs: publish-package
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: ./dist
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Generate a GitHub release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: dist/*
tcolorpy-0.1.7/.gitignore 0000664 0000000 0000000 00000002575 14734264226 0015405 0 ustar 00root root 0000000 0000000 # Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# User settings
_sandbox/
bin/
*_profile
Untitled.ipynb
tcolorpy-0.1.7/CHANGELOG.md 0000664 0000000 0000000 00000005753 14734264226 0015227 0 ustar 00root root 0000000 0000000
# [v0.1.6](https://github.com/thombashi/tcolorpy/releases/tag/v0.1.6) - 27 Apr 2024
* Fix the package release
**Full Changelog**: https://github.com/thombashi/tcolorpy/compare/v0.1.5...v0.1.6
[Changes][v0.1.6]
# [v0.1.5](https://github.com/thombashi/tcolorpy/releases/tag/v0.1.5) - 27 Apr 2024
## What's Changed
* Bump actions/setup-python from 4 to 5 in the actions-dependencies group by [@dependabot](https://github.com/dependabot) in https://github.com/thombashi/tcolorpy/pull/4
* Update CI by [@thombashi](https://github.com/thombashi) in https://github.com/thombashi/tcolorpy/pull/5
* Add `__all__` to `__init__.py`
* Add support for Python 3.12
* Add CHANGELOG.md
* Modify to use `setuptools_scm` for package build
## New Contributors
* [@dependabot](https://github.com/dependabot) made their first contribution in https://github.com/thombashi/tcolorpy/pull/4
**Full Changelog**: https://github.com/thombashi/tcolorpy/compare/v0.1.4...v0.1.5
[Changes][v0.1.5]
# [v0.1.4](https://github.com/thombashi/tcolorpy/releases/tag/v0.1.4) - 16 Sep 2023
- Improve type annotations
- Modify to use `pypa/build` for package build
- Remove deprecated `setup.py` calls
- Update `[build-system]`
**Full Changelog**: https://github.com/thombashi/tcolorpy/compare/v0.1.3...v0.1.4
[Changes][v0.1.4]
# [v0.1.3](https://github.com/thombashi/tcolorpy/releases/tag/v0.1.3) - 05 May 2023
- Add support for Python 3.11
- Drop support for Python 3.6
- Update a help message of CLI
[Changes][v0.1.3]
# [v0.1.2](https://github.com/thombashi/tcolorpy/releases/tag/v0.1.2) - 26 Feb 2022
## What's Changed
* Use extras in tox instead of self-referencing the package in deps by [@hroncok](https://github.com/hroncok) in https://github.com/thombashi/tcolorpy/pull/1
* Removed shebang from __main__.py by [@hegjon](https://github.com/hegjon) in https://github.com/thombashi/tcolorpy/pull/3
## New Contributors
* [@hroncok](https://github.com/hroncok) made their first contribution in https://github.com/thombashi/tcolorpy/pull/1
* [@hegjon](https://github.com/hegjon) made their first contribution in https://github.com/thombashi/tcolorpy/pull/3
**Full Changelog**: https://github.com/thombashi/tcolorpy/compare/v0.1.1...v0.1.2
[Changes][v0.1.2]
# [v0.1.0](https://github.com/thombashi/tcolorpy/releases/tag/v0.1.0) - 12 Jun 2021
- Add `hsv` property to `Color` class
- Drop support for Python 3.5
[Changes][v0.1.0]
[v0.1.6]: https://github.com/thombashi/tcolorpy/compare/v0.1.5...v0.1.6
[v0.1.5]: https://github.com/thombashi/tcolorpy/compare/v0.1.4...v0.1.5
[v0.1.4]: https://github.com/thombashi/tcolorpy/compare/v0.1.3...v0.1.4
[v0.1.3]: https://github.com/thombashi/tcolorpy/compare/v0.1.2...v0.1.3
[v0.1.2]: https://github.com/thombashi/tcolorpy/compare/v0.1.0...v0.1.2
[v0.1.0]: https://github.com/thombashi/tcolorpy/tree/v0.1.0
tcolorpy-0.1.7/LICENSE 0000664 0000000 0000000 00000002067 14734264226 0014416 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) 2020-2024 Tsuyoshi Hombashi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
tcolorpy-0.1.7/MANIFEST.in 0000664 0000000 0000000 00000000313 14734264226 0015137 0 ustar 00root root 0000000 0000000 include LICENSE
include README.rst
include pyproject.toml
include tox.ini
include */py.typed
recursive-include requirements *
recursive-include test *
global-exclude __pycache__/*
global-exclude *.pyc
tcolorpy-0.1.7/Makefile 0000664 0000000 0000000 00000003344 14734264226 0015050 0 ustar 00root root 0000000 0000000 PACKAGE := tcolorpy
BIN_DIR := $(shell pwd)/bin
BUILD_WORK_DIR := _work
PKG_BUILD_DIR := $(BUILD_WORK_DIR)/$(PACKAGE)
PYTHON := python3
BIN_CHANGELOG_FROM_RELEASE := $(BIN_DIR)/changelog-from-release
AUTHOR := Tsuyoshi Hombashi
FIRST_RELEASE_YEAR := 2020
LAST_UPDATE_YEAR := $(shell git log -1 --format=%cd --date=format:%Y)
$(BIN_CHANGELOG_FROM_RELEASE):
GOBIN=$(BIN_DIR) go install github.com/rhysd/changelog-from-release/v3@latest
.PHONY: build
build: clean
@$(PYTHON) -m tox -e build
ls -lh dist/*
.PHONY: build-remote
build-remote: clean
@mkdir -p $(BUILD_WORK_DIR)
@cd $(BUILD_WORK_DIR) && \
git clone https://github.com/thombashi/$(PACKAGE).git --depth 1 && \
cd $(PACKAGE) && \
tox -e build
ls -lh $(PKG_BUILD_DIR)/dist/*
.PHONY: changelog
changelog: $(BIN_CHANGELOG_FROM_RELEASE)
$(BIN_CHANGELOG_FROM_RELEASE) > CHANGELOG.md
.PHONY: check
check:
@$(PYTHON) -m tox -e lint
.PHONY: clean
clean:
rm -rf $(BIN_DIR) $(BUILD_WORK_DIR)
$(PYTHON) -m tox -e clean
.PHONY: fmt
fmt:
@$(PYTHON) -m tox -e fmt
.PHONY: release
release:
$(PYTHON) -m tox -e release
$(MAKE) clean
.PHONY: setup-ci
setup-ci:
$(PYTHON) -m pip install -q --disable-pip-version-check --upgrade pip
$(PYTHON) -m pip install -q --disable-pip-version-check --upgrade tox
.PHONY: setup-dev
setup-dev: setup-ci
$(PYTHON) -m pip install -q --disable-pip-version-check --upgrade -e .[test]
$(PYTHON) -m pip check
.PHONY: test
test:
$(PYTHON) -m tox -e py
.PHONY: update-copyright
update-copyright:
sed -i "s/^__copyright__ = .*/__copyright__ = f\"Copyright $(FIRST_RELEASE_YEAR)-$(LAST_UPDATE_YEAR), {__author__}\"/" $(PACKAGE)/__version__.py
sed -i "s/^Copyright (c) .* $(AUTHOR)/Copyright (c) $(FIRST_RELEASE_YEAR)-$(LAST_UPDATE_YEAR) $(AUTHOR)/" LICENSE
tcolorpy-0.1.7/README.rst 0000664 0000000 0000000 00000011060 14734264226 0015071 0 ustar 00root root 0000000 0000000 .. contents:: **tcolorpy**
:backlinks: top
:depth: 2
Summary
============================================
tcolopy is a Python library to apply true color for terminal text.
|PyPI pkg ver| |conda pkg ver| |Supported Python implementations| |Supported Python versions| |CI status| |CodeQL| |coverage|
.. |PyPI pkg ver| image:: https://badge.fury.io/py/tcolorpy.svg
:target: https://badge.fury.io/py/tcolorpy
:alt: PyPI package version
.. |conda pkg ver| image:: https://anaconda.org/conda-forge/tcolorpy/badges/version.svg
:target: https://anaconda.org/conda-forge/tcolorpy
:alt: conda-forge package version
.. |Supported Python implementations| image:: https://img.shields.io/pypi/implementation/tcolorpy.svg
:target: https://pypi.org/project/tcolorpy
:alt: Supported Python implementations
.. |Supported Python versions| image:: https://img.shields.io/pypi/pyversions/tcolorpy.svg
:target: https://pypi.org/project/tcolorpy
:alt: Supported Python versions
.. |CI status| image:: https://github.com/thombashi/tcolorpy/actions/workflows/ci.yml/badge.svg
:target: https://github.com/thombashi/tcolorpy/actions/workflows/ci.yml
:alt: CI status of Linux/macOS/Windows
.. |CodeQL| image:: https://github.com/thombashi/tcolorpy/actions/workflows/github-code-scanning/codeql/badge.svg
:target: https://github.com/thombashi/tcolorpy/actions/workflows/github-code-scanning/codeql
:alt: CodeQL
.. |coverage| image:: https://coveralls.io/repos/github/thombashi/tcolorpy/badge.svg?branch=master
:target: https://coveralls.io/github/thombashi/tcolorpy?branch=master
:alt: Test coverage: coveralls
Installation
============================================
Installation: pip
------------------------------
::
pip install tcolorpy
Installation: conda
------------------------------
::
conda install -c conda-forge tcolorpy
Usage
============================================
Library usage
--------------------------------------------
:Sample Code:
.. code-block:: python
from tcolorpy import tcolor
print(tcolor("tcolopy example", color="#ee1177", styles=["bold", "italic", "underline"]))
:Output:
.. figure:: https://cdn.jsdelivr.net/gh/thombashi/tcolorpy@master/ss/oneline.png
:scale: 60%
:alt: https://github.com/thombashi/tcolorpy/blob/master/ss/oneline.png
You can set the following ``tcolor`` arguments:
- ``color``/``bg_color``
- color names (``"red"``, ``"green"``, etc.) or color code (``"#RRGGBB"``)
- ``styles``
- ``"bold"``, ``"italic"``, etc.
Other examples
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Apply true color and styles to text:
.. figure:: https://cdn.jsdelivr.net/gh/thombashi/tcolorpy@master/ss/styles.png
:scale: 60%
:alt: https://github.com/thombashi/tcolorpy/blob/master/ss/styles.png
`example source code `__
You can also specify colors by name:
.. figure:: https://cdn.jsdelivr.net/gh/thombashi/tcolorpy@master/ss/ansi_colors.png
:scale: 60%
:alt: https://github.com/thombashi/tcolorpy/blob/master/ss/ansi_colors.png
`example source code `__
CLI usage
--------------------------------------------
``tcolorpy`` can be used via CLI:
::
$ python3 -m tcolorpy "tcolopy example" -c "#ee1177" -s bold,italic,underline
Command help
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
usage: __main__.py [-h] [-c COLOR] [-b BG_COLOR] [-s STYLES] [--encode ENCODE] string
positional arguments:
string string to apply styles.
options:
-h, --help show this help message and exit
-c COLOR, --color COLOR
specify a color code (#XXXXXX) or a name. valid names are: black, red, green, yellow, blue, magenta, cyan, white, lightblack, lightred, lightgreen, lightyellow, lightblue, lightmagenta, lightcyan, lightwhite
-b BG_COLOR, --bg-color BG_COLOR
specify a background color code (#XXXXXX) or a name. valid names are: black, red, green, yellow, blue, magenta, cyan, white, lightblack, lightred, lightgreen, lightyellow, lightblue, lightmagenta, lightcyan, lightwhite
-s STYLES, --styles STYLES
specify a comma-separated style. valid values are: bold, dim, italic, underline, blink, invert, strike
--encode ENCODE output a text encoded with the specified encoding
Dependencies
============================================
Python 3.9+
no external dependencies.
tcolorpy-0.1.7/examples/ 0000775 0000000 0000000 00000000000 14734264226 0015222 5 ustar 00root root 0000000 0000000 tcolorpy-0.1.7/examples/ansi_colors.py 0000775 0000000 0000000 00000001341 14734264226 0020111 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python3
import sys
from tcolorpy import AnsiBGColor, AnsiFGColor, tcolor
def main() -> int:
template = "{:26} {:26} {:26}"
print(
template.format(
tcolor("color", color="white"),
tcolor("bg_color", color="white"),
tcolor("invert", color="white"),
)
)
print("━" * 50)
for fg_color, bg_color in zip(AnsiFGColor, AnsiBGColor):
print(
template.format(
tcolor(fg_color.name, color=fg_color),
tcolor(bg_color.name, bg_color=bg_color),
tcolor(fg_color.name, color=fg_color, styles=["invert"]),
)
)
return 0
if __name__ == "__main__":
sys.exit(main())
tcolorpy-0.1.7/examples/ansi_styles.py 0000775 0000000 0000000 00000003060 14734264226 0020133 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python3
import sys
from tcolorpy import Color, tcolor
def print_truecolor(c: Color) -> None:
end = " "
print(tcolor(c.color_code, bg_color=c), end=end)
print(tcolor(c.color_code, color=c), end=end)
print(tcolor(c.color_code, color=c, styles=["bold"]), end=end)
print(tcolor(c.color_code, color=c, styles=["dim"]), end=end)
print(tcolor(c.color_code, color=c, styles=["italic"]), end=end)
print(tcolor(c.color_code, color=c, styles=["underline"]), end=end)
print(tcolor(c.color_code, color=c, styles=["invert"]), end=end)
print(tcolor(c.color_code, color=c, styles=["strike"]), end=end)
print()
def main() -> int:
step = 32
print(
"bg_color {color} {bold} {dim} {italic} {underline} {invert} {strike}".format( # noqa
color="color",
bold=tcolor("bold", styles=["bold"]),
dim=tcolor("dim", styles=["dim"]),
italic=tcolor("italic", styles=["italic"]),
underline=tcolor("underline", styles=["underline"]),
invert=tcolor("invert", styles=["invert"]),
strike=tcolor("strike", styles=["strike"]),
)
)
for i in range(0, 255, step):
print_truecolor(Color((255, i, 0)))
for i in range(0, 255, step):
print_truecolor(Color((255 - i, 255, 0)))
for i in range(0, 255, step):
print_truecolor(Color((0, 255, i)))
for i in range(0, 255, step):
print_truecolor(Color((0, 255 - i, 255)))
return 0
if __name__ == "__main__":
sys.exit(main())
tcolorpy-0.1.7/examples/background_colors.py 0000775 0000000 0000000 00000001175 14734264226 0021303 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python3
import sys
from tcolorpy import Color, tcolor
def main() -> int:
string = " "
step = 8
line = ""
for i in range(0, 255, step):
line += tcolor(string, bg_color=Color((255, i, 0)))
for i in range(0, 255, step):
line += tcolor(string, bg_color=Color((255 - i, 255, 0)))
for i in range(0, 255, step):
line += tcolor(string, bg_color=Color((0, 255, i)))
for i in range(0, 255, step):
line += tcolor(string, bg_color=Color((0, 255 - i, 255)))
for r in range(16):
print(line)
return 0
if __name__ == "__main__":
sys.exit(main())
tcolorpy-0.1.7/examples/lib.py 0000775 0000000 0000000 00000000220 14734264226 0016337 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python3
from tcolorpy import tcolor
print(tcolor("tcolopy example", color="#ee1177", styles=["bold", "italic", "underline"]))
tcolorpy-0.1.7/pyproject.toml 0000664 0000000 0000000 00000003262 14734264226 0016323 0 ustar 00root root 0000000 0000000 [build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=64",
"setuptools_scm>=8",
]
[tool.setuptools_scm]
version_scheme = "guess-next-dev"
local_scheme = "no-local-version"
[tool.black]
exclude = '''
/(
\.eggs
| \.git
| \.mypy_cache
| \.tox
| \.venv
| \.pytype
| _build
| buck-out
| build
| dist
)/
| docs/conf.py
'''
line-length = 100
target-version = ['py39', 'py310', 'py311', 'py312']
[tool.coverage.run]
branch = true
source = ['tcolorpy']
[tool.coverage.report]
exclude_lines = [
'except ImportError',
'raise NotImplementedError',
'pass',
'ABCmeta',
'abstractmethod',
'warnings.warn',
]
precision = 1
show_missing = true
[tool.isort]
include_trailing_comma = true
known_third_party = [
'pytest',
]
line_length = 100
lines_after_imports = 2
multi_line_output = 3
skip_glob = [
'*/.eggs/*',
'*/.pytype/*',
'*/.tox/*',
]
[tool.mypy]
ignore_missing_imports = true
python_version = 3.9
pretty = true
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
no_implicit_optional = true
show_error_codes = true
show_error_context = true
warn_redundant_casts = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true
[tool.pyright]
exclude = [
"**/node_modules",
"**/__pycache__",
".tox",
".venv",
"_build",
"_sandbox",
"build",
"dist"
]
pythonVersion = "3.9"
[tool.pytest.ini_options]
testpaths = [
"test",
]
md_report = true
md_report_color = "auto"
md_report_verbose = 0
[tool.ruff]
line-length = 100
target-version = "py39"
exclude = [
".eggs/",
".tox/",
"_sandbox/*",
"build/",
"docs/conf.py",
]
tcolorpy-0.1.7/requirements/ 0000775 0000000 0000000 00000000000 14734264226 0016127 5 ustar 00root root 0000000 0000000 tcolorpy-0.1.7/requirements/requirements.txt 0000664 0000000 0000000 00000000000 14734264226 0021401 0 ustar 00root root 0000000 0000000 tcolorpy-0.1.7/requirements/test_requirements.txt 0000664 0000000 0000000 00000000046 14734264226 0022452 0 ustar 00root root 0000000 0000000 pytest>=6.0.1
pytest-md-report>=0.6.2
tcolorpy-0.1.7/setup.py 0000664 0000000 0000000 00000005257 14734264226 0015127 0 ustar 00root root 0000000 0000000 import os.path
import re
import setuptools
MODULE_NAME = "tcolorpy"
REPOSITORY_URL = f"https://github.com/thombashi/{MODULE_NAME:s}"
REQUIREMENT_DIR = "requirements"
ENCODING = "utf8"
pkg_info: dict[str, str] = {}
def get_release_command_class() -> dict[str, type[setuptools.Command]]:
try:
from releasecmd import ReleaseCommand
except ImportError:
return {}
return {"release": ReleaseCommand}
def make_long_description() -> str:
# ref: https://github.com/pypa/readme_renderer/issues/304
re_exclude = re.compile(r"\s*:scale:\s*\d+")
with open("README.rst", encoding=ENCODING) as f:
return "".join([line for line in f if not re_exclude.search(line)])
with open(os.path.join(MODULE_NAME, "__version__.py")) as f:
exec(f.read(), pkg_info)
with open(os.path.join(REQUIREMENT_DIR, "test_requirements.txt")) as f:
TESTS_REQUIRES = [line.strip() for line in f if line.strip()]
setuptools.setup(
name=MODULE_NAME,
url=REPOSITORY_URL,
author=pkg_info["__author__"],
author_email=pkg_info["__email__"],
description="tcolopy is a Python library to apply true color for terminal text.",
include_package_data=True,
keywords=["ANSI escape", "terminal color", "truecolor"],
license=pkg_info["__license__"],
long_description=make_long_description(),
long_description_content_type="text/x-rst",
packages=setuptools.find_packages(exclude=["test*"]),
package_data={MODULE_NAME: ["py.typed"]},
project_urls={
"Changelog": f"{REPOSITORY_URL:s}/blob/master/CHANGELOG.md",
"Source": REPOSITORY_URL,
"Tracker": f"{REPOSITORY_URL:s}/issues",
},
python_requires=">=3.9",
extras_require={"test": TESTS_REQUIRES},
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Terminals",
"Topic :: Text Processing",
"Typing :: Typed",
],
zip_safe=False,
cmdclass=get_release_command_class(),
)
tcolorpy-0.1.7/ss/ 0000775 0000000 0000000 00000000000 14734264226 0014031 5 ustar 00root root 0000000 0000000 tcolorpy-0.1.7/ss/ansi_colors.png 0000664 0000000 0000000 00000140674 14734264226 0017066 0 ustar 00root root 0000000 0000000 PNG
IHDR 1 EdN sRGB gAMA a pHYs od QIDATx^|\UڇwOݕR
wYuaeYYXaqww+)iҸ{g=so2oI$=Oνګ眫4j
FsOD"9R4ZxOD"ZD"H$B{4{N:(+w7q۽7Ɂzo,_=o;nq1[Q|m=0\pC="F?q??OF<IO%qK!jnfp <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