Skip to content

avanisubbiah/material-color-utilities-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

material-color-utilities-python

Chat on Matrix

Python port of material-color-utilities used for Material You colors

Original source code: https://github.com/material-foundation/material-color-utilities

NOTE: This is an unofficial port of material-color-utilities from JavaScript to Python

Build and install

You need to have Poetry installed

poetry build
poetry install

Usage examples for Themeing

Theme from color:

from material_color_utilities_python import *

theme = themeFromSourceColor(argbFromHex('#4285f4'))

print(theme)

Color from image:

from material_color_utilities_python import *

img = Image.open('path/to/image.png')
argb = sourceColorFromImage(img)

print(hexFromArgb(argb))

Theme from image:

from material_color_utilities_python import *

img = Image.open('/path/to/image')
basewidth = 64
wpercent = (basewidth/float(img.size[0]))
hsize = int((float(img.size[1])*float(wpercent)))
img = img.resize((basewidth,hsize),Image.Resampling.LANCZOS)
print(themeFromImage(img))

print(theme)

About

Python port of material-color-utilities used for Material You colors

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages