Skip to content

Choose foreground of text color based on background color.

License

Notifications You must be signed in to change notification settings

azaitsev/foreground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

foreground

Choose black or white foreground color of text based on background color to get better contrast. W3C compliant.

example

Installation

pip install foreground

Usage

Pass background color to get black or white foreground color

from foreground import get_foreground

get_foreground('#85C1E9')
# '#000000'

get_foreground('#85C1E9', output='RGB') # output as RGB tuple
# (0, 0, 0)

get_foreground((133, 193, 233)) # working with RGB
# '#000000'

get_foreground((133, 193, 233), output='RGB') # RGB input and output
# '#000000'

Releases

No releases published

Packages

No packages published

Languages