Skip to content

Oori's generic python toolkit. Nothing much to see here

License

Notifications You must be signed in to change notification settings

OoriData/Utiloori

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Utiloori - oori's miscellaneous toolkit

Utiloori is primarily developed by the crew at Oori Data. We offer software engineering services around LLM applications.

PyPI - Version PyPI - Python Version

Table of contents:

Print ansi colors in terminal

Wraps text in ANSI color codes (and terminators) for printing colored text to console.

Some terminals, notably VSCode's, try to be clever about not displaying unreadable text; they might override the font color you specify if you specify a background color that is too similar to the font color. For example, if you specify a black font color on a red background, VSCode will override the font color to white.

colors

the following "standard" ansi colors are supported:

  • black
  • red
  • green
  • yellow
  • blue
  • purple
  • cyan
  • white

Usage

from utiloori.ansi_color import ansi_color

print string with green font:

green_string = ansi_color('lorem', 'green')
print(green_string)

print string with purple background (with default, white font):

purple_bg_string = ansi_color('ipsum', bg_color='purple')
print(purple_bg_string)

print string with red font on a blue background:

red_on_blue_string = ansi_color('dolor', 'red', 'blue')
print(red_on_blue_string)