Skip to content

An utility to create python gradients, wont be updated

Notifications You must be signed in to change notification settings

Leiiib/Python-Gradients

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Python Gradients

An utility to create and print gradients in Python

Features

  • Compact
  • Dynamic (adapts to text size)
  • Supports RGB!

Usage/Examples

To create a gradient, use the gradient and pass as argumets two rgb colors.

from gradient import  Color, gradient

text = """
████████╗███████╗██╗  ██╗████████╗
╚══██╔══╝██╔════╝╚██╗██╔╝╚══██╔══╝
   ██║   █████╗   ╚███╔╝    ██║   
   ██║   ██╔══╝   ██╔██╗    ██║   
   ██║   ███████╗██╔╝ ██╗   ██║   
   ╚═╝   ╚══════╝╚═╝  ╚═╝   ╚═╝   
"""

print(gradient(Color(112, 11, 250), Color(40, 221, 242), text))

App Screenshot App Screenshot App Screenshot App Screenshot

Doing animated gradients is a little more complicated. To use them, you will need to have a loop and create an Animation instance, which takes two colors, the text, the animation duration and a step:

from gradient import animated_gradient, Color, Animation

text = """
████████╗███████╗██╗  ██╗████████╗
╚══██╔══╝██╔════╝╚██╗██╔╝╚══██╔══╝
   ██║   █████╗   ╚███╔╝    ██║   
   ██║   ██╔══╝   ██╔██╗    ██║   
   ██║   ███████╗██╔╝ ██╗   ██║   
   ╚═╝   ╚══════╝╚═╝  ╚═╝   ╚═╝   
"""

animation = Animation(Color(40, 221, 242), Color(112, 11, 250), text, 5, .5)

while True:
    print(animated_gradient(animation))

    #Other actions

    animation.tick()

App Screenshot

TODO

  • Add vertical and if i have the required IQ diagonal.
  • Support more than 2 colors.

About

An utility to create python gradients, wont be updated

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages