Repository navigation
Conversation
Add a palette=spectra6 render descriptor for 6-colour e-ink panels (black, white, yellow, red, blue, green): - applyEinkProcessing(..., palette) gains a colour branch (PNG only, checked before the bitDepth/grayscale paths): flatten alpha on white, mild saturation/contrast boost, serpentine Floyd-Steinberg in RGB against a perceptual ink palette, then write the canonical colours as an exact 4-bit indexed PNG (6-entry PLTE). No grayscale, no negate, no downscale. - The PNG is hand-encoded: sharp/libimagequant with colours: 6 re-quantizes an already 6-colour image into fewer, shifted colours. - display.service appends palette=spectra6 to plugin and designed-screen render URLs when the device model has colors === 6 (PNG models only). - The plugin render route and /api/device-images/design/:id accept palette (whitelist: spectra6; anything else is ignored) and thread it through PluginsService/PluginRendererService/ScreenRendererService. - Uploaded screens are unchanged (only the 1-bit dithered file is stored).
New spectra6_800x480 model (image/png, colors 6, bitDepth 1 so default and sleep screens keep the 1-bit path). The container runs the idempotent seed on every boot, so existing databases pick the model up on upgrade without touching existing rows.
- Device page "Current Screen": plugin playlist items were never rendered (the default screen was returned); render them as einkPreview with the device's palette (paletteForModel), so a Spectra 6 device shows its colour image. - Plugin einkPreview renders (instance form, Screens/Playlists thumbnails) carry no palette: derive it from the devices showing the instance. An explicit palette param still wins; device/preview modes are never inferred.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spectra 6 colour e-ink support
Adds colour output for 6-colour Spectra 6 panels (black, white, yellow, red, blue, green), e.g. the Seeed EE04 with the 7.3" 800x480 Spectra 6 panel on TRMNL firmware 1.8.x. Today every device image is forced through grayscale + 1-bit dithering, so these panels only show black and white even though the firmware's
png_draw_6clrdecoder handles colour PNGs.How it works
spectra6_800x480, PNG,colors: 6,bitDepth: 1). Existing installs get it on the next container start, because the idempotent seed runs on every boot.colors === 6,/api/displayaddspalette=spectra6to plugin and designed-screen render URLs. Both render endpoints acceptpalette; onlyspectra6is recognised and other values are ignored.palette=spectra6,applyEinkProcessingkeeps the image in colour. It flattens alpha on white, applies a mild saturation/contrast boost, and runs serpentine Floyd–Steinberg error diffusion in RGB against a perceptual palette that approximates real Spectra 6 inks. Each pixel is then written as a pure canonical colour (#000/#fff/#ff0/#f00/#00f/#0f0), so it maps unambiguously through the firmware's RGB333 nearest-colour table. The firmware does no dithering or inversion on Spectra panels, so there is no negate here.colours: 6re-quantizes an already 6-colour image into shifted colours.Unchanged
mode=preview.Tests
cd backend && bun test: 456 pass. Unit tests for the dither and encoder: pure colours stay pure with no negation, every output pixel is one of the 6 canonical colours, and the PLTE holds exactly 6 entries (decoded round-trip, odd width). Also tests for the display URL descriptor and for the palette whitelist on both endpoints.