Add visual separators: inverted banner sections on receipts, dividers in navbar
deploy / deploy (push) Successful in 9s

ReceiptBuilder#invert (GS B) + #section_separator give the test page (and
future receipts) a full-width white-on-black banner between sections --
the closest a direct-thermal printer gets to a second color. Navbar gets
a vr divider between Home | Brother/Shipping labels/Receipts | Labels to
group the three logical clusters.
This commit is contained in:
randy committed 2026-09-13 12:16:09 +02:00
1 parent f8857384fd
commit eafea9f728
3 files changed
+24 -14

No files matched your search

+13
View File
@@ -65,6 +65,19 @@ class ReceiptBuilder
self
end
# White-on-black reverse video (GS B n) -- the closest this direct-thermal
# printer gets to a second "color" for a separator/banner.
def invert(enable = true)
@buffer << (enable ? "\x1D\x42\x01" : "\x1D\x42\x00")
self
end
# A full-width inverted banner line, e.g. section_separator("SECTION").
def section_separator(label = '', width: 48)
padded = label.empty? ? (' ' * width) : " #{label} ".center(width)
feed(1).invert.text(padded[0, width]).invert(false).feed(1)
end
def size(mode)
@buffer << case mode
when :big then TXT_BIG