Skip to main content

Python package for snaping/rounding colors to other colors/palettes.

Project description

# Colorsnap

Python package for snaping/rounding colors to other colors/palettes.

Colorsnap comes with predefined palettes for CSS 2-4 and can also take custom ones defined by you as input and then snap/round a specified color to the closes one in the given palette.

## Installing

pip install colorsnap

# Usage Examples

import colorsnap

Available palettes:
- CSS_2
- CSS_2_1
- CSS_3
- CSS_4

colorsnap.snap_color(colorsnap.palettes.CSS_3, '#0000ba')
# >>> ('#0000ba', 'mediumblue')

# Using a custom palette
palette = {
'black': '#000000',
'gray': '#808080',
'white': '#ffffff',

colorsnap.snap_color(palette, '#0000ba')

# Using a custom palette with unnamed colors
palette = ['#4286f4', '#414449']

color_snap.snap_color(palette, '#5588db')
# >>> ('#5588db', '#4286f4')


Project details

Download files

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

Files for colorsnap, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size colorsnap-1.1.0.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page