Tweak grid style to be more like MS Paint

Avoid the cell background showing past the left/top of the border of the cell, by using left/top-aligned characters (▛▌▀) rather than centered border characters (┼┆┄).
This commit is contained in:
Isaiah Odhner 2023-07-19 22:14:03 -04:00
parent 507470ad10
commit 8b79dd98a9

View File

@ -2191,18 +2191,17 @@ class Canvas(Widget):
ch = self.big_ch(ch, x % self.magnification, y % self.magnification)
if self.show_grid and self.magnification >= 4:
if x % self.magnification == 0 or y % self.magnification == 0:
# bg = "#808080"...
# Not setting `bg` here, because:
# Its actually useful to see the background color of the cell,
# as it lets you distinguish between a space " " and a full block "█".
# Plus this makes the grid more subtle, although it looks a little weird
# how the border line is inset a bit into the cell...
fg = "#c0c0c0"
# Plus this lets the grid be more subtle, visually taking up less than a cell.
fg = "#c0c0c0" if (x + y) % 2 == 0 else "#808080"
if x % self.magnification == 0 and y % self.magnification == 0:
ch = ""
ch = "" # "┼"
elif x % self.magnification == 0:
ch = ""
ch = "" # "┆"
elif y % self.magnification == 0:
ch = ""
ch = "" # "┄"
style = Style(color=fg, bgcolor=bg)
assert style.color is not None
assert style.bgcolor is not None