Skip to content

tylercrompton/color

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Color.py

Color is an immutable class that allows one to do anything needed with colors.

There are many ways to create in instance of the Color class; one of which is to provide the RGB value and the color depth if a hexadecimal representation is not given.

>>> Color(245, 16, 42)
Color(245, 16, 42, 24)
>>> Color(4, 187, 32, 30)
Color(4, 187, 32, 36)
>>> Color('45fe0b')
Color(69, 254, 11, 24)
>>> Color('#87b3f0')
Color(135, 179, 240, 24)
>>> Color('#fff')
Color(15, 15, 15, 12)
>>> Color((127, 127, 127))
Color(127, 127, 127, 24)
>>> Color(1023, 1023, 1023, 30)
Color(1023, 1023, 1023, 30)

However, the simplest way is to use the provided constants. Any color from the SVG 1.1 color keyword names with underscores separating words is supported.

>>> Color.RED
Color(255, 0, 0, 24)
>>> Color.DODGER_BLUE
Color(30, 144, 255, 24)
>>> Color.PAPAYA_WHIP
Color(255, 239, 213, 24)

About

A package to handle colors in Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages