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 without any external dependencies.

Example

Find more Examples.

package main

import (
	"encoding/json"
	"image/jpeg"
	"log"
	"os"

	"github.com/Nadim147c/material/v2"
)

func main() {
	f, err := os.Open("quantizer/gophar.jpg")
	if err != nil {
		log.Fatal(err)
	}
	defer f.Close()

	img, err := jpeg.Decode(f)
	if err != nil {
		log.Fatal(err)
	}

	colors, err := material.Generate(
		material.FromImage(img),
		material.WithDark(true),
		material.WithVariant(material.VariantTonalSpot),
	)
	if err != nil {
		log.Fatal(err)
	}

	json.NewEncoder(os.Stdout).Encode(colors) // prints the colors as json
}

License

This project is licensed under the Apache License, Version 2.0.

It incorporates code derived from Material Color Utilities by Google LLC, used under the terms of the Apache License, Version 2.0.

The included gophar image, used as test data, is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) license, attributed to Renee French.

For additional details and third-party attributions, see the NOTICE file.

About

🎨 A pure go implementation of Material Color Utilities.

Topics

Resources

License

Stars

Watchers

Forks