colorama icon indicating copy to clipboard operation
colorama copied to clipboard

Background color of Unicode characters not displayed completely

Open mark-wehrmann opened this issue 2 years ago • 1 comments

import colorama

colorama.init() print("\N{WHITE CHESS KNIGHT}") print("\N{WHITE CHESS ROOk}") print(colorama.Back.YELLOW + "\N{WHITE CHESS KNIGHT}" + colorama.Back.RESET) print(colorama.Back.RED + "\N{WHITE CHESS ROOK}" + colorama.Back.RESET)

This give following output: image

As you can see the background color of the Chess figures is only displayed up to half of the actual character.

Is there a workaround available?

mark-wehrmann avatar Mar 23 '22 17:03 mark-wehrmann

Just FYI, it seems a lot of fonts don't respect / don't properly define the width of some / all unicode characters. Try printing several knights / rooks on the same line, they're probably going to be on top of each other.

For example, in Windows 10 with PowerShell 7.3.6, I don't even get the characters - but the width is correct: image

In whatever font VSCode uses, I get the same as you: image

If I add a space after the characters in question, the background "fills in":

import colorama

colorama.init()
print("\N{WHITE CHESS KNIGHT}")
print("\N{WHITE CHESS ROOK}")
print(colorama.Back.YELLOW + "\N{WHITE CHESS KNIGHT} " + colorama.Back.RESET)
print(colorama.Back.RED + "\N{WHITE CHESS ROOK} " + colorama.Back.RESET)

image

shaperilio avatar Jul 28 '23 17:07 shaperilio