Added some comments.

This commit is contained in:
Amy G. Dalin 2025-02-17 01:26:41 -05:00
parent 158268694e
commit ae30d743c9

View File

@ -170,6 +170,9 @@ func sqr(a float64) float64 {
return a * a
}
// Distance returns the perceptual distance between two colors.
//
// This controls for possible transparency. Two different but otherwise fully transparent colors would have a distance of zero.
func Distance(a, b Color) float64 {
L1, a1, b1 := a.Lightness*a.A, a.ChromaA*a.A, a.ChromaB*a.A
L2, a2, b2 := b.Lightness*b.A, b.ChromaA*b.A, b.ChromaB*b.A
@ -186,6 +189,8 @@ func okLabModel(c color.Color) color.Color {
var (
// A color model for converting arbitrary colors to OKLab.
//
// Wraps the [FromColor] function, returning a [color.Color] interface rather than the [Color] type.
Model = color.ModelFunc(okLabModel)
// Type assertions.