This repository contains Pixlet apps in the apps/ directory.
Scaffold a new app: pixlet create apps/<appname>
pixlet lint: Checks for common issues and style problems.pixlet check: Validates correctness and best practices.pixlet format: Auto-formats code for consistency.
Run a live-reloading local server for rapid iteration: pixlet serve apps/<appname>/<app_name>.star.
Generate a preview image before publishing:
pixlet render -z 9 apps/<appname>/<app_name>.star
# For 2x support preview:
pixlet render -2 -z 9 apps/<appname>/<app_name>.starScreenshot paths will be apps/<appname>/<appname>.webp and apps/<appname>/<appname>@2x.webp.
- No
try/catch: Starlark lacks exception handling. Use conditional checks instead. - Skipping Rendering: Return an empty array (
return []) in your main function to skip rendering for the current cycle (e.g., when data is unavailable). - Loading Local Files: Load local assets directly into global variables using the
filetarget. For example, this loadsapps/<appname>/images/example.png:load("images/example.png", EXAMPLE_IMAGE = "file")
Manage complex settings with a config file/schema. Pass configuration arguments via the CLI during development:
pixlet render apps/<appname>/<app_name>.star key=value- For sensitive values like API keys or passwords, schema definitions should use
secret = True. - For boolean options (from schema.Toggle), values should be retrieved using
config.bool("key")instead ofconfig.get("key").
- 2x apps render at 128x64 instead of the standard 64x32.
- Check the
canvasmodule:canvas.size()returns(width, height);canvas.width(),canvas.height(),canvas.is2x(). - Common patterns:
WIDTH, HEIGHT = canvas.size() SCALE = 2 if canvas.is2x() else 1
- Multiply/divide sizes by
SCALE(use//or convert toint; floats are rejected). - Default 1x font is
tb-8; default 2x font isterminus-16. - Animations: If using
render.Marquee, halve the delay for 2x to maintain scroll speed. If halving the delay speeds up embeddedrender.Imageanimations, use the image'shold_framesparameter to slow it back down.
Square panels render at 64x64. They are a different canvas shape, not a
higher resolution, so canvas.is2x() is false on them.
There are three real canvases: 64x32 (classic), 128x64 (2x, is2x() true)
and 64x64 (square, is2x() false).
- Tell panels apart by shape, never by size:
Do not test
WIDTH, HEIGHT = canvas.size() def is_square(): w, h = canvas.size() return h == w
HEIGHT == 64: the 128x64 wide panel is also 64 tall. Do not use heuristics on the aspect ratio either --h == wis the definition. - Declare the capability in
manifest.yaml:This is what puts thesupports64x64: true
64x64badge on the app in the app store and lets users filter for apps their display can show. CI fails an app that adapts its layout for square panels without declaring the flag, so add it in the same change as the layout work. - Preview:
The
pixlet render -w 64 -t 64 -z 9 apps/<appname>/<app_name>.star -o apps/<appname>/<appname>@64x64.webp
@64x64.webpscreenshot is optional. Unlike@2x.webpits presence does not imply the capability -- a screenshot shows a preview exists, not that the author checked the app on a square panel.supports64x64stays a manifest assertion. - A square panel has twice the vertical room of a classic panel and the same width, so the usual port is to stack what the 64x32 layout puts side by side, or to show more rows of the same content.
An app that can't work (for example, because the service it depends on has
gone or now blocks requests) is marked broken in manifest.yaml:
broken: true
brokenReason: 'api.example.com: no such host'- Tronbyt Server's app store shows a BROKEN badge with the reason, and the App Viewer shows a warning. Keep the reason short and specific.
- PR checks skip
pixlet checkfor broken apps. - Only mark an app broken if it fails consistently, not after a single failed request.
- When you fix an app, remove both lines in the same pull request. Checks
will then run
pixlet checkon the app again, so it must pass.
- Modules | Widgets | Animation | Schema | Filters
- Fonts: Run
pixlet community list-fontsor view the Fonts Reference. - Icons: Run
pixlet community list-icons.