项目作者: azaitsev

项目描述 :
Choose foreground of text color based on background color.
高级语言: Python
项目地址: git://github.com/azaitsev/foreground.git
创建时间: 2019-09-01T00:47:01Z
项目社区:https://github.com/azaitsev/foreground

开源协议:MIT License

下载


foreground

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

example

Installation

  1. pip install foreground

Usage

Pass background color to get black or white foreground color

  1. from foreground import get_foreground
  2. get_foreground('#85C1E9')
  3. # '#000000'
  4. get_foreground('#85C1E9', output='RGB') # output as RGB tuple
  5. # (0, 0, 0)
  6. get_foreground((133, 193, 233)) # working with RGB
  7. # '#000000'
  8. get_foreground((133, 193, 233), output='RGB') # RGB input and output
  9. # '#000000'