<commit_before>package draw

import (
	"image/color"
)

type PrettyPalette struct {
	CachePalette
}

func NewPrettyPalette(iterateLimit uint8) Palette {
	black := color.NRGBA{
		R: 0, G: 0, B: 0, A: 255,
	}
	return PrettyPalette{
		NewCachePalette(iterateLimit, black, prettyCacher),
	}
}

// Cache redscale colour values
func prettyCacher(limit uint8, index uint8) color.NRGBA {
	linear := float64(limit - index)
	qx := linear - 122.5
	qa := 255.0 / (122.5 * 122.5)
	quadratic := qa * qx * qx
	cx := linear - 61.25
	ca := -255 / (61.25 * 61.25 * 61.25)
	cubic := ca * cx * cx * cx
	interval := 255.0 / float64(limit)
	return color.NRGBA{
		R: uint8(linear * interval),
		G: uint8(quadratic * interval),
		B: uint8(cubic * interval),
		A: 255,
	}
}<commit_msg>Pretty palette supports other limits<commit_after>package draw

import (
	"image/color"
)

type PrettyPalette struct {
	CachePalette
}

func NewPrettyPalette(iterateLimit uint8) Palette {
	black := color.NRGBA{
		R: 0, G: 0, B: 0, A: 255,
	}
	return PrettyPalette{
		NewCachePalette(iterateLimit, black, prettyCacher),
	}
}

// Cache redscale colour values
func prettyCacher(limit uint8, index uint8) color.NRGBA {
	limitF := float64(limit)
	linear := float64(limit - index)
	halfLimit := limitF / 2.0
	quatLimit := limitF / 4.0
	qx := linear - halfLimit
	qa := limitF / (halfLimit * halfLimit)
	quadratic := qa * qx * qx
	cx := linear - quatLimit
	ca := -limitF / (quatLimit * quatLimit * quatLimit)
	cubic := ca * cx * cx * cx
	interval := 255.0 / limitF
	return color.NRGBA{
		R: uint8(linear * interval),
		G: uint8(quadratic * interval),
		B: uint8(cubic * interval),
		A: 255,
	}
}
{'fraction_non_alphanumeric': 0.13479052823315119, 'fraction_numerical': 0.05160898603521554, 'mean_word_length': 3.5905292479108635, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4503138', 'n_tokens_mistral': 716, 'n_tokens_neox': 640, 'n_words': 172}