<commit_before># Converts ANSI color sequences to HTML.
#
# The ansi_to_html module is based on code from
# https://github.com/rtomayko/bcat/blob/master/lib/bcat/ansi.rb

entities = require "entities"

STYLES =
	'ef0':	'color:#000' # black
	'ef1':	'color:#df4f3e' # dark red
	'ef2':	'color:#8ae234' # dark green
	'ef3':	'color:#db970d' # dark yellow
	'ef4':	'color:#729fcf' # dark blue
	'ef5':	'color:#ad7fa8' # dark magenta
	'ef6':	'color:#34e2e2' # dark cyan
	'ef7':	'color:#bbb' # dark light gray
	'ef8':	'color:#bbb' # gray
	'ef9':	'color:#df4f3e' # red
	'ef10':	'color:#91cb58' # green
	'ef11':	'color:#c5a200' # yellow
	'ef12':	'color:#3465a4' # blue
	'ef13':	'color:#ad7fa8' # magenta
	'ef14':	'color:#2bd0d0' # cyan
	'ef15':	'color:#FFF' # white
	'eb0':	'background-color:#000' # black
	'eb1':	'background-color:#df4f3e' # dark red
	'eb2':	'background-color:#8ae234' # dark green
	'eb3':	'background-color:#db970d' # dark yellow
	'eb4':	'background-color:#729fcf' # dark blue
	'eb5':	'background-color:#ad7fa8' # dark magenta
	'eb6':	'background-color:#34e2e2' # dark cyan
	'eb7':	'background-color:#bbb' # dark light gray
	'eb8':	'background-color:#bbb' # gray
	'eb9':	'background-color:#df4f3e' # red
	'eb10':	'background-color:#91cb58' # green
	'eb11':	'background-color:#c5a200' # yellow
	'eb12':	'background-color:#3465a4' # blue
	'eb13':	'background-color:#ad7fa8' # magenta
	'eb14':	'background-color:#2bd0d0' # cyan
	'eb15':	'background-color:#FFF' # white

toHexString = (num) ->
	num = num.toString(16)
	while num.length < 2 then num = "0#{num}"
	num

[0..5].forEach (red) ->
	[0..5].forEach (green) ->
		[0..5].forEach (blue) ->
			c = 16 + (red * 36) + (green * 6) + blue
			r = if red   > 0 then red   * 40 + 55 else 0
			g = if green > 0 then green * 40 + 55 else 0
			b = if blue  > 0 then blue  * 40 + 55 else 0
			rgb = (toHexString(n) for n in [r, g, b]).join('')
			STYLES["ef#{c}"] = "color:##{rgb}"
			STYLES["eb#{c}"] = "background-color:##{rgb}"
<commit_msg>lowercase colors<commit_after># Converts ANSI color sequences to HTML.
#
# The ansi_to_html module is based on code from
# https://github.com/rtomayko/bcat/blob/master/lib/bcat/ansi.rb

entities = require "entities"

STYLES =
	'ef0':	'color:#000' # black
	'ef1':	'color:#df4f3e' # dark red
	'ef2':	'color:#8ae234' # dark green
	'ef3':	'color:#db970d' # dark yellow
	'ef4':	'color:#729fcf' # dark blue
	'ef5':	'color:#ad7fa8' # dark magenta
	'ef6':	'color:#34e2e2' # dark cyan
	'ef7':	'color:#bbb' # dark light gray
	'ef8':	'color:#bbb' # gray
	'ef9':	'color:#df4f3e' # red
	'ef10':	'color:#91cb58' # green
	'ef11':	'color:#c5a200' # yellow
	'ef12':	'color:#3465a4' # blue
	'ef13':	'color:#ad7fa8' # magenta
	'ef14':	'color:#2bd0d0' # cyan
	'ef15':	'color:#fff' # white
	'eb0':	'background-color:#000' # black
	'eb1':	'background-color:#df4f3e' # dark red
	'eb2':	'background-color:#8ae234' # dark green
	'eb3':	'background-color:#db970d' # dark yellow
	'eb4':	'background-color:#729fcf' # dark blue
	'eb5':	'background-color:#ad7fa8' # dark magenta
	'eb6':	'background-color:#34e2e2' # dark cyan
	'eb7':	'background-color:#bbb' # dark light gray
	'eb8':	'background-color:#bbb' # gray
	'eb9':	'background-color:#df4f3e' # red
	'eb10':	'background-color:#91cb58' # green
	'eb11':	'background-color:#c5a200' # yellow
	'eb12':	'background-color:#3465a4' # blue
	'eb13':	'background-color:#ad7fa8' # magenta
	'eb14':	'background-color:#2bd0d0' # cyan
	'eb15':	'background-color:#fff' # white

toHexString = (num) ->
	num = num.toString(16)
	while num.length < 2 then num = "0#{num}"
	num

[0..5].forEach (red) ->
	[0..5].forEach (green) ->
		[0..5].forEach (blue) ->
			c = 16 + (red * 36) + (green * 6) + blue
			r = if red   > 0 then red   * 40 + 55 else 0
			g = if green > 0 then green * 40 + 55 else 0
			b = if blue  > 0 then blue  * 40 + 55 else 0
			rgb = (toHexString(n) for n in [r, g, b]).join('')
			STYLES["ef#{c}"] = "color:##{rgb}"
			STYLES["eb#{c}"] = "background-color:##{rgb}"

{'fraction_non_alphanumeric': 0.204471238382316, 'fraction_numerical': 0.07987942727957799, 'mean_word_length': 4.253298153034301, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 2, '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': '1038243', 'n_tokens_mistral': 1971, 'n_tokens_neox': 1742, 'n_words': 397}