Important
🔥 Found this useful? A quick star goes a long way.
A pure go implementation of Material Color Utilities
package main
import (
"fmt"
"image/jpeg"
"log"
"os"
"github.com/Nadim147c/material"
"github.com/Nadim147c/material/dynamic"
)
func main() {
file, err := os.Open("gophar.jpg")
if err != nil {
panic(err)
}
img, err := jpeg.Decode(file)
if err != nil {
log.Fatalf("failed to decode image: %v", err)
}
colors, err := material.GenerateFromImage(
img,
dynamic.VariantExpressive,
true,
0,
dynamic.PlatformPhone,
dynamic.Version2021,
)
if err != nil {
log.Fatalf("failed to generate colors: %v", err)
}
for key, value := range colors {
fmt.Println(key, value)
}
}This project is licensed under the Apache License, Version 2.0. It includes code derived from Material Color Utilities by Google LLC, originally licensed under the Apache License 2.0.
See the NOTICE file for details and third-party attributions.