Add Board, Colors, and Measured-Colors headers to display API requests#299
Add Board, Colors, and Measured-Colors headers to display API requests#299oetiker wants to merge 2 commits intousetrmnl:mainfrom
Conversation
Send device board identifier and display color palette as HTTP headers so the backend can tailor responses to specific hardware capabilities. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
thanks for this. i'm curious why it's needed however. currently our Device Model picker maps the hardware's capabilities (colors, selected palette, screen size, etc) to our render pipeline, which generates images according to those specs and then returns that graphic to the device. https://trmnl.com/api/models i could see this being useful if (for example) a Kindle and a Nook were requesting content with the same API key, as it would allow the user sets their device's model + palette preferences, and all requests for content with that device's API key incorporate those specs. |
|
@ryanckulp I am the author of byonk, I added support for all the new device types you added recently. In order to properly prepare the images my software needs to know the available colors. Instead of tracking the models, I thought it would be simpler if the device could tell the backend which colors its display supports. actually come to think of it, if the firmware was not only to provide the pallette to use for the png but also what the color looks like that would make image preparation even simpler. |
|
Thank you for opening this PR. I understand its importance, but I’ll need some time before I can review it properly. I’ll share my feedback once I’ve had a chance to go through it. |
Enables server-side dithering/quantization using real measured display colors rather than idealized palette values. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
DEVICE_BOARD,DISPLAY_COLORS, andDISPLAY_MEASURED_COLORSmacros inconfig.hfor all supported hardware variantsdisplayColors,displayMeasuredColors, andboardfields toApiDisplayInputsColors,Board, andMeasured-ColorsHTTP headers in display API requestsWhy
The backend currently has no way to know which board variant or display color palette a device supports. By sending these as headers, the API can return optimized images matched to the actual hardware — e.g. serving 4-color images to
trmnl_og_4clror 16-shade grayscale totrmnl_x.Measured-Colorsprovides the actual sRGB values the e-ink panel produces (derived from Pimoroni's photographed saturated palette and community spectrophotometer data), enabling better server-side dithering and quantization compared to idealized palette values.Test plan
🤖 Generated with Claude Code