azaitsev / foreground

Choose foreground of text color based on background color.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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'

About

Choose foreground of text color based on background color.

License:MIT License


Languages

Language:Python 100.0%