Skip to main content

Find the best background and foreground color combinations from a given RGB value

Project description

TwitterFacebookInstagramYouTubeWhatsAppWWWPinterestE-Mail


cmatcher

Use the package to determine the best background and foreground color combinations (e.g. for web page design)

Screenshot of Test


Just download use

pip install cmatcher

Here is the code I used to print the stuff on the screenshot

This is basically everything you need to know

from cmatcher import CMatcher

cormatcher = CMatcher() #create an instance, first time takes longer because a color dataframe will be created and saved to HDD

for x in range(100):

    luminancedifference_from_best_result = choice(range(80,99)) #the higher the number, the less results (more contrast), max is 99

    hsv_difference_from_best_result = choice(range(80,99)) #the higher the number, the less results (more contrast), max is 99

    print(f'{x}. Test - Lum: {luminancedifference_from_best_result} - hsv: {hsv_difference_from_best_result}')

    cormatcher.get_best_contrast_colors(

        color=(choice(range(256)), choice(range(256)), choice(range(256))),

        lum_dif=luminancedifference_from_best_result,

        hsv_dif=hsv_difference_from_best_result,

    ) #this is the most important method, it finds all good combinations

    cormatcher.print_results() #a method to see all results in color

    print(cormatcher.results) #the results are saved in this list

    print('----------------------------------------------------------------------------')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmatcher-0.11.tar.gz (27.2 kB view hashes)

Uploaded Source

Built Distribution

cmatcher-0.11-py3-none-any.whl (27.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page