Allow changing the default background color in PixelImage #33
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
windows
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
kahliburke/Tachikoma.jl#33
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi @kahliburke !
I saw that
PixelImagehas a fieldbgthat is supposed to contain the background color. However, I cannot use it to store a default background color because it is overwritten heregithub.com/kahliburke/Tachikoma.jl@c2ab53de99/src/sixel_image.jl (L79), which callscanvas_bgand replace the color I selected. Am I understanding it right? If so, can we add a function insidePixelImageso that we have more control?@ronisbr Looking into this.
Hi @ronisbr! You're right —
_sync_pixelimage_bg!was unconditionally overwriting the user-setbgwithcanvas_bg(). This is fixed onmainnow.What changed
PixelImagehas a newbg_tracks_canvas::Boolfield. Whentrue(the default if you don't passbg), the background trackscanvas_bg()across theme changes — same as before. Whenfalse, your chosen color is preserved.Constructor: passing
bg=my_colornow disables canvas tracking automatically:set_background!(img, color): changes the bg at runtime — rewrites any pixels currently holding the old bg to the new color and disables tracking.reset_background!(img): re-enables canvas tracking and immediately syncs to the currentcanvas_bg().Both are exported.
The
sixel_gallerydemo's Flame Graph pane now uses a custom bg with a[b]keybind to cycle throughindigo → crimson → forest → trackedto demonstrate the feature end-to-end.Awesome! Thanks!