Improvements Wishlist
Plugin API: the tones of 0.8 for bars and dots too, and a green one
CompletedPlugin API 0.8 gives a plugin ui::set_tone() with ACCENT, BUSY (amber) and ALERT (red) for a tile's labels and icons. A plugin that shows a level (CO2, a battery, a price) also draws bars and dots, and needs the same colours for those, plus a green one for "good". Today a plugin can only reach them through theme::key_swatch() and theme::rgb(), which is not part of the plugin API.
A ui::tone_color(Tone) (or set_tone for a block's fill) and a Tone::GOOD from Home Assistant's green would cover it, in light and dark alike.
Stefan
Discussion 2
Add a commentThanks Stefan, this is on dev now, in plugin API 0.9:
Tone::GOODis Home Assistant's green. It sits besideACCENT,BUSY(amber) andALERT(red), and is made readable on the card in light and dark like the others.ui::set_fill(block, tone, normal)gives a block (a bar, a dot, a badge) the colour of a tone.ui::tone_color(tone, normal)returns the colour itself, for a part those two don't reach, such as a line of a chart.normalis the theme role forNORMAL. So a level that is good, moderate or bad isGOOD,BUSYandALERT, with nokey_swatchorrgbneeded.ui::labelpromised one line cut with dots, but kept LVGL's own height, so a long text wrapped onto a second line under the tile. A label is now one line of its font high, andui::set_fontkeeps it so.Tested with the core's host probe plugin on the CYD and the Guition, with and without kept pages: the four tones come out as 4CAF50, FFC107, F44336 and the ink, a block filled with
GOODis green, and a label is exactly one line high. The existing plugins render pixel for pixel as before. A plugin that uses these namesapi: "0.9"; that comes with the next release, usually within a week, and Tessera's dev firmware has it now. docs/FIRMWARE_API.md in the plugins repository describes them.The new bench in the plugins repository (
tools/preview.py, docs/PREVIEW.md) shows such a tile on every kind of screen in light and dark. It also says when a word or a bar is too faint to read on its ground.A correction to my last line: the bench's contrast check looks at text only, not at bars. It reports a word too faint to read on its ground, in light and dark. A bar or a dot in a colour that doesn't stand out shows in the bench's pictures, but no finding names it.