Added some comments.
This commit is contained in:
		
							
								
								
									
										5
									
								
								oklab.go
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								oklab.go
									
									
									
									
									
								
							| @ -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. | ||||
|  | ||||
		Reference in New Issue
	
	Block a user