Leave a ⭐ if you like this repository
hexstyle is a tiny, dependency-free Python package that lets you print colored text in your terminal using HEX color codes — just like in web design. It's simple, lightweight, and supports every imaginable color with easy-to-use helper functions.
Install from PyPI:
pip install hexstylePyPI: https://pypi.org/project/hexstyle/
import hexstyle
print(hexstyle.set("#ff0000") + "Hello, world!" + hexstyle.reset())hexstyle.set(hex: str)
hex: the hex color you want to use
- Use any HEX color to style your terminal text
- Lightweight & dependency-free — pure Python
- Works on most modern terminals (Windows, macOS, Linux)
- ANSI color codes may not display correctly in environments that don't support truecolor (24-bit) — for example, some older Windows terminals or minimal Docker shells.
- Output colors may vary slightly depending on your terminal theme or emulator.
- This package only affects terminal (stdout) text — it won’t color text in log files or GUI applications.
- Unicode/emoji characters work fine, but truecolor accuracy may vary between fonts or shells.
A short interactive example:
import hexstyle
print(hexstyle.set("#ff0000") + "Hello, world!" + hexstyle.reset())
input(hexstyle.set("#00ff00") + "How are you today?: " + hexstyle.set("#0000ff"))- If you see weird formatting like
←[38;2;255;0;0mHello, world!←[0m, try clearing the terminal (clson Windows,clearon Linux/macOS) or switching to a terminal that supports ANSI colors.
- Project on PyPI: pypi.org/project/hexstyle/
- Telegram: @Swezy
Distributed under the MIT License — see LICENSE for details.
Made with ❤️ — If you find this useful, please leave a ⭐ on the repo
