Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Nadim147c/material

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Material

GitHub go.mod Go version GitHub Repo stars GitHub License GitHub Tag

Important

🔥 Found this useful? A quick star goes a long way.

A pure go implementation of Material Color Utilities

Example

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

License

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.

About

🎨 Pure go implementation of Material Color Utilities

Topics

Resources

License

Stars

Watchers

Forks