colors

package
v0.0.0-...-eb18d79 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package color provides general utilities for image/color objects and color codes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateImage

func CreateImage(clr *color.RGBA, xSize, ySize int) (*bytes.Buffer, error)

CreateImage generates a PNG image filled with the passed color in the size of the passed xSize and ySize dimensions.

The generated image is returned as bytes.Buffer reference. When the image generation fails, an error is returned.

func FromHex

func FromHex(hexVal string) (*color.RGBA, error)

FromHex returns a color.RGBA object reference from the passed hexVal HEX RGBA color code.

When the passed color code is malformed, an error is returned.

func GetVibrantColorFromImage

func GetVibrantColorFromImage(img image.Image) (clr int, err error)

GetVibrantColorFromImage returns the vribrant accent color of an image passed.

func GetVibrantColorFromImageUrl

func GetVibrantColorFromImageUrl(url string) (clr int, err error)

GetVibrantColorFromImageUrl requests the image from the given URL and returns the vribrant accent color of an image passed.

func ToHex

func ToHex(clr *color.RGBA) string

ToHex returns a HEX RBGA color string from the passed color.RGBA object reference.

func ToInt

func ToInt(clr *color.RGBA) int

ToInt returns an integer color value from the oassed color.RGBA object reference.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL