Skip to content

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

License

Notifications You must be signed in to change notification settings

Abbe98/colorsnap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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')

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages