score

package
v0.2.0-beta Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FallbackColor color.ARGB = 0xff4285f4

Google Blue

Functions

func DifferenceDegrees

func DifferenceDegrees(a, b float64) float64

DifferenceDegrees returns the shortest angular difference between two angles in degrees.

func NewScore

func NewScore() *score

NewScore creates a new Score instance with default constants

func SanitizeDegreesInt

func SanitizeDegreesInt(degrees int) int

SanitizeDegreesInt ensures a degree measure is within the range [0, 360).

func Score

func Score(colorsToPopulation map[color.ARGB]int, opts ScoreOptions) []color.ARGB

Score is a package-level convenience function that creates a Score instance and returns scored colors

Types

type ScoreOptions

type ScoreOptions struct {
	Desired  int
	Fallback color.ARGB
	Filter   bool
}

ScoreOptions provides configuration for ranking colors based on usage counts.

Desired: is the max count of the colors returned. FallbackColorARGB: Is the default color that should be used if no other colors are suitable.

Filter: controls if the resulting colors should be filtered to not include hues that are not used often enough, and colors that are effectively grayscale.

Jump to

Keyboard shortcuts

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