colorama
colorama copied to clipboard
Background color of Unicode characters not displayed completely
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:
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?
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:
In whatever font VSCode uses, I get the same as you:
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)