colorcmp

package
v0.0.0-...-683b059 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package colorcmp supports comparing colors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Brighter

func Brighter(a, b color.Color) bool

Brighter takes two colors and returns whether color a brighter than color b by gray scale comparison.

func ColorStr

func ColorStr(clr color.Color) string

ColorStr converts clr to 8-bit-per-channel, non-pre-alpha-multiplied RGBA and returns either a "#rrggbb" representation if it's fully opaque or "#rrggbbaa" otherwise.

func ColorsMatch

func ColorsMatch(a, b color.Color, maxDiff uint8) bool

ColorsMatch takes two colors and returns whether or not each component is within maxDiff of each other after conversion to 8-bit-per-channel, non-alpha-premultiplied RGBA.

func DominantColor

func DominantColor(im image.Image) (clr color.Color, ratio float64)

DominantColor returns the color that occupies the largest number of pixels in the passed in image. It also returns the ratio of that pixel to the number of overall pixels in the image.

func RGB

func RGB(r, g, b uint8) color.Color

RGB returns a fully-opaque color.Color based on the supplied components.

Types

This section is empty.

Jump to

Keyboard shortcuts

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