<commit_before>// Package ansirgb converts color.Color's to ANSI colors
package ansirgb

import (
	"fmt"
	"image/color"
)

// Color represents an ANSI color
type Color struct {
	color.Color
	Code	int
}

// String returns a small description of the color
// containing ANSI code and a hex representation of
// the RGB value, e.g. " 26: 0000 4B4B D2D2"
func (c *Color) String() string {
	r, g, b, _ := c.RGBA()
	return fmt.Sprintf("%3d: \033[38;5;%dm%04X %04X %04X\033[0m", c.Code, c.Code, r, g, b)
}

// Fg returns the escape code for foreground color
func (c *Color) Fg() string {
	return fmt.Sprintf("\033[38;5;%dm", c.Code)
}

// Bg returns the escape code for background color
func (c *Color) Bg() string {
	return fmt.Sprintf("\033[48;5;%dm", c.Code)
}

var (
	// Palette contains all 256 ANSI colors
	Palette = make(color.Palette, 0, 255)
)

func init() {
	var r uint8
	var g uint8
	var b uint8

	// 8 Bit colors
	var min8 uint8
	var max8 uint8 = 170
	for i := 0; i <= 15; i++ {
		if i == 8 {
			min8 = 85
			max8 = 255
		}
		if i & 1 == 1 {
			r = max8
		} else {
			r = min8
		}
		if i & 2 == 2 {
			g = max8
		} else {
			g = min8
		}
		if i & 4 == 4 {
			b = max8
		} else {
			b = min8
		}
		Palette = append(Palette, &Color{&color.RGBA{r, g, b, 255}, i})
	}

	// 6 * 6 * 6 = 216 colors
	var start uint8 = 75
	var step uint8 = 45
	r = 0
	g = 0
	b = 0
	for i := 16; i <= 231; i++ {
		Palette = append(Palette, &Color{&color.RGBA{r, g, b, 255}, i})
		b = next(b, start, step)
		if i > 16 {
			if (i - 15) % 6 == 0 {
				g = next(g, start, step)
			}
			if (i - 15) % (6 * 6) == 0 {<commit_msg>stay closer to xterm's colors<commit_after>// Package ansirgb converts color.Color's to ANSI colors
package ansirgb

import (
	"fmt"
	"image/color"
)

// Color represents an ANSI color
type Color struct {
	color.Color
	Code	int
}

// String returns a small description of the color
// containing ANSI code and a hex representation of
// the RGB value, e.g. " 26: 0000 4B4B D2D2"
func (c *Color) String() string {
	r, g, b, _ := c.RGBA()
	return fmt.Sprintf("%3d: \033[38;5;%dm%04X %04X %04X\033[0m", c.Code, c.Code, r, g, b)
}

// Fg returns the escape code for foreground color
func (c *Color) Fg() string {
	return fmt.Sprintf("\033[38;5;%dm", c.Code)
}

// Bg returns the escape code for background color
func (c *Color) Bg() string {
	return fmt.Sprintf("\033[48;5;%dm", c.Code)
}

var (
	// Palette contains all 256 ANSI colors
	Palette = make(color.Palette, 0, 255)
)

func init() {
	var r uint8
	var g uint8
	var b uint8

	// 8 Bit colors
	var min8 uint8
	var max8 uint8 = 170
	for i := 0; i <= 15; i++ {
		if i == 8 {
			min8 = 85
			max8 = 255
		}
		if i & 1 == 1 {
			r = max8
		} else {
			r = min8
		}
		if i & 2 == 2 {
			g = max8
		} else {
			g = min8
		}
		if i & 4 == 4 {
			b = max8
		} else {
			b = min8
		}
		Palette = append(Palette, &Color{&color.RGBA{r, g, b, 255}, i})
	}

	// 6 * 6 * 6 = 216 colors
	var start uint8 = 95
	var step uint8 = 40
	r = 0
	g = 0
	b = 0
	for i := 16; i <= 231; i++ {
		Palette = append(Palette, &Color{&color.RGBA{r, g, b, 255}, i})
		b = next(b, start, step)
		if i > 16 {
			if (i - 15) % 6 == 0 {
				g = next(g, start, step)
			}
			if (i - 15) % (6 * 6) == 0 {
{'fraction_non_alphanumeric': 0.15568676196395276, 'fraction_numerical': 0.07271597265382225, 'mean_word_length': 2.472491909385113, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '3976940', 'n_tokens_mistral': 1597, 'n_tokens_neox': 1340, 'n_words': 468}