I've tried several permutations of the following code with no luck:
Code: Select all
buf = bytearray(b'\x00\x01')
fb_palette = FrameBuffer(buf, 2, 1, GS4_HMSB)
fb_target.blit(fb_source, 0, 0, -1, fb_palette)
Code: Select all
buf = bytearray(b'\x00\x01')
fb_palette = FrameBuffer(buf, 2, 1, GS4_HMSB)
fb_target.blit(fb_source, 0, 0, -1, fb_palette)
Code: Select all
class BoolPalette(framebuf.FrameBuffer):
def __init__(self, mode):
buf = bytearray(4) # OK for <= 16 bit color
super().__init__(buf, 2, 1, mode)
def fg(self, color): # Set foreground color
self.pixel(1, 0, color)
def bg(self, color):
self.pixel(0, 0, color)
Code: Select all
palette = self.device.palette
palette.bg(self.fgcolor if invert else self.bgcolor)
palette.fg(self.bgcolor if invert else self.fgcolor)
self.device.blit(fbc, s.text_col, s.text_row, -1, palette)
Code: Select all
bg, fg = 0, 15
palette = FrameBuffer(bytearray(1), 2, 1, GS4_HMSB)
palette.pixel(1, 0, fg)
palette.pixel(0, 0, bg)
target.blit(source, 0, 0, -1, palette)
Code examples are always more helpful to me rather than explanations. As soon as I saw your code it became clear.pythoncoder wrote: ↑Mon Aug 08, 2022 8:07 amI'm glad you've sorted it. I guess the official docs are rather terse (my fault).