I convert all colors to HLS, and then ensure that all foreground colors are between 0% and 40% light, and all background colors are between 60% and 100% light.
This works specifically with the output of ANSI HTML adapter (aha), which I assume to be similar to ansi2html. Looping over re.split is just a nice way to make a traditional unixy pipeline tool.
Here are some examples of syntax highlighted git diffs with two different syntax themes:
| Visual Studio Dark+ | Solarized | |
| original |
|
|
| white background |
|
|
| white background with clamped L |
|
|
ANSI generated with delta:
git diff | delta --color-only --syntax-theme='Solarized (dark)' | aha --black
git diff | delta --color-only --syntax-theme='Solarized (dark)' | aha
git diff | delta --color-only --syntax-theme='Solarized (dark)' | aha | python ./dark2light.py
git diff | delta --color-only --syntax-theme='Visual Studio Dark+' | aha --black
git diff | delta --color-only --syntax-theme='Visual Studio Dark+' | aha
git diff | delta --color-only --syntax-theme='Visual Studio Dark+' | aha | python ./dark2light.py










