This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python2 | |
# -*- coding: utf-8 -*- | |
# | |
# This routine is adapted from: https://gist.github.com/jdiaz5513/9218791 | |
# | |
# Things I changed: | |
# * Cache the results of color_distance() lookups, for a big speed-up. | |
# * Adjusted the RGB values for ANSI_COLORS to match original CGA values | |
# * Changed default fill character to a PC-ANSI shaded block character | |
# * Added some timer code to help with optimizing the conversion routine |