{"id":42173332,"url":"https://github.com/sysprog21/libiui","last_synced_at":"2026-01-26T21:34:16.637Z","repository":{"id":331240561,"uuid":"1125849656","full_name":"sysprog21/libiui","owner":"sysprog21","description":"A complete Material Design 3 implementation in pure C","archived":false,"fork":false,"pushed_at":"2026-01-02T05:38:23.000Z","size":492,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-04T21:51:41.441Z","etag":null,"topics":["embedded-systems","gui-toolkit","immediate-mode-ui","material-design","vector-graphics","widget-library"],"latest_commit_sha":null,"homepage":"https://sysprog21.github.io/libiui/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sysprog21.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-31T13:44:47.000Z","updated_at":"2026-01-02T05:38:26.000Z","dependencies_parsed_at":"2026-01-05T09:03:18.070Z","dependency_job_id":null,"html_url":"https://github.com/sysprog21/libiui","commit_stats":null,"previous_names":["sysprog21/libiui"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/sysprog21/libiui","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysprog21%2Flibiui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysprog21%2Flibiui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysprog21%2Flibiui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysprog21%2Flibiui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sysprog21","download_url":"https://codeload.github.com/sysprog21/libiui/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysprog21%2Flibiui/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28788370,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T21:13:08.818Z","status":"ssl_error","status_checked_at":"2026-01-26T21:13:08.448Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["embedded-systems","gui-toolkit","immediate-mode-ui","material-design","vector-graphics","widget-library"],"created_at":"2026-01-26T21:34:16.090Z","updated_at":"2026-01-26T21:34:16.631Z","avatar_url":"https://github.com/sysprog21.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libiui\n\nA complete [Material Design 3](https://m3.material.io/) (MD3) implementation in pure C.\nAround 10K lines of C99. No dependencies beyond libc, not even for fonts.\n\nUntil now, Material Design 3 existed only within the walled gardens of Android (Jetpack Compose),\niOS (via Flutter), and web browsers—platforms where megabytes of runtime overhead are acceptable.\nMicrocontrollers, real-time systems, and resource-constrained environments had no path to modern UI design.\n\nlibiui opens that path.\nThe same visual language powering billions of Android devices now runs on a Cortex-M4 with 64KB RAM,\ncompiles to WebAssembly for browser deployment, and integrates into game engines without framework dependencies.\nOne codebase, one API, identical pixels everywhere.\n\nWhat makes this possible: zero heap allocations (the application provides a fixed buffer),\nno widget trees or retained state (pure immediate-mode), native vector graphics (lines, circles, arcs),\na built-in single-line vector font (no FreeType, no external font files),\nand complete renderer abstraction (four callbacks—the library never touches graphics APIs).\nThe result is predictable memory usage, deterministic performance, and trivial porting.\n\n## Full MD3 Compliance with Configurable Features\nlibiui implements the complete Material Design 3 specification, not an approximation.\nEvery dimension, color token, state layer opacity,\nand motion curve follows the official guidelines published at [m3.material.io](https://m3.material.io/).\nThe test suite validates 349 cases against the reference implementation in [material-components-android](https://github.com/material-components/material-components-android).\n\nFor embedded systems where every byte counts, libiui uses [Kconfig](https://github.com/sysprog21/Kconfiglib) to let you include only what you need.\nDisable animations, accessibility features, or vector drawing (lines, circles, arcs) to shrink the footprint.\nEnable them when targeting desktop or web where resources are plentiful.\nThe same codebase scales from a microcontroller to a full-featured desktop application.\n\n| MD3 Aspect | Specification | Configurable |\n|------------|---------------|--------------|\n| Color system | 32 semantic tokens, light/dark themes | Always included |\n| Typography | MD3 type scale with built-in vector font | Always included |\n| Motion | Duration tokens, 7 easing curves | `CONFIG_FEATURE_ANIMATION` |\n| Elevation | Levels 0-5, dual shadows | Always included |\n| State layers | 8%/12%/12%/16%/38% opacity | Always included |\n| Dimensions | Button 40dp, FAB 56dp, Chip 32dp, 48dp touch targets | Always included |\n| Accessibility | WCAG 2.1 contrast ratios, focus indicators | `CONFIG_FEATURE_ACCESSIBILITY` |\n| Vector graphics | Lines, circles, arcs for custom drawing | `CONFIG_FEATURE_VECTOR` |\n\n## Use Cases\nEmbedded systems: Runs on microcontrollers with limited RAM.\nThe application controls all memory through a user-provided buffer.\nKconfig lets you disable features like animation, accessibility, or vector graphics to fit tighter constraints.\n\nGame engine integration: The callback-based renderer slots directly into existing rendering pipelines.\nNo OpenGL, Vulkan, or DirectX assumptions.\nYou provide four functions; the library handles the rest.\n\nLightweight desktop tools: Modern Material Design aesthetics without Qt, GTK, or Electron overhead.\nEnable all features for a complete MD3 experience in under 100KB.\n\nKiosk and industrial HMI: Deterministic memory usage and minimal footprint suit resource-constrained deployments.\nThe immediate-mode architecture guarantees consistent frame times.\n\n## Platform Support\nlibiui runs anywhere C runs.\nThe callback-based renderer abstracts away platform specifics:\n\n| Platform | Backend | Description |\n|----------|---------|-------------|\n| Desktop (Linux/macOS/Windows) | SDL2 | Software rendering with full input handling |\n| Web browsers | WebAssembly | Compile with Emscripten, render to Canvas |\n| Embedded | Custom | Implement four callbacks for your display driver |\n| Game engines | Native | Slot into existing OpenGL/Vulkan/DirectX pipelines |\n\nA single codebase produces native desktop applications, browser-based tools,\nand embedded firmware—all with identical MD3 visuals and behavior.\n\n## Design\nImmediate-mode architecture: call `iui_button()`, get a boolean, done.\nNo widget objects, no tree traversal, no state synchronization.\nThe widget exists only for the duration of the function call.\n\nStrict MD3 compliance, not \"inspired by\" Material Design.\nButton height 40dp, touch targets 48dp, state layers at exactly 8%/12%/12%/16%/38%.\nThe test suite verifies these values against the official specification.\n\n## Quick Start\n```shell\nmake                 # Build library and demo\nmake check           # Run 349 API tests\n./libiui_example     # Interactive demo\n```\n\n## Configuration\nlibiui uses [Kconfig](https://github.com/sysprog21/Kconfiglib) for build-time feature selection.\nThis allows embedded developers to include only the features they need, reducing code size and memory usage.\n\n```shell\nmake defconfig       # SDL2 backend, all features enabled\nmake config          # Interactive configuration menu\n```\n\nPre-defined configurations:\n\n| Target | Backend | Purpose |\n|--------|---------|---------|\n| defconfig | SDL2 | Desktop development with full features |\n\nAvailable configuration options:\n\n| Option | Description |\n|--------|-------------|\n| `CONFIG_PORT_SDL2` | SDL2 backend for desktop platforms |\n| `CONFIG_PORT_HEADLESS` | Headless backend for CI and testing |\n| `CONFIG_PORT_WASM` | WebAssembly backend via Emscripten |\n| `CONFIG_FEATURE_ACCESSIBILITY` | WCAG contrast checking, screen reader hints |\n| `CONFIG_FEATURE_ANIMATION` | MD3 motion system with easing curves |\n| `CONFIG_FEATURE_VECTOR` | Line, circle, and arc drawing primitives |\n\nA minimal embedded configuration disables optional features, yielding a smaller binary that still provides full MD3-compliant widgets.\nUse `make config` to customize for your target platform.\n\n## Combining Layout and Components\nlibiui combines flexible layout with MD3 components in a single immediate-mode API:\n\n```c\n#include \"iui.h\"\n\nstatic uint8_t buffer[65536];\niui_config_t cfg = iui_make_config(buffer, renderer, 16.0f, NULL);\niui_context *ctx = iui_init(\u0026cfg);\n\nvoid frame(float dt)\n{\n    iui_begin_frame(ctx, dt);\n    iui_begin_window(ctx, \"Settings\", 100, 100, 400, 300, 0);\n\n    /* Flex layout: sidebar + content */\n    iui_flex(ctx, 2, (float[]){120, -1}, 0, 8);\n\n    /* Sidebar with navigation */\n    iui_button(ctx, \"General\", IUI_ALIGN_LEFT);\n    iui_button(ctx, \"Audio\", IUI_ALIGN_LEFT);\n    iui_button(ctx, \"Video\", IUI_ALIGN_LEFT);\n    iui_flex_next(ctx);\n\n    /* Content area */\n    static bool enabled = true;\n    if (iui_checkbox(ctx, \"Enable feature\", \u0026enabled))\n        printf(\"Toggled: %s\\n\", enabled ? \"on\" : \"off\");\n\n    static float volume = 50.f;\n    iui_slider(ctx, \"Volume\", 0.f, 100.f, 1.f, \u0026volume, \"%.0f%%\");\n\n    if (iui_button(ctx, \"Apply\", IUI_ALIGN_LEFT))\n        apply_settings();\n\n    iui_flex_end(ctx);\n    iui_end_window(ctx);\n    iui_end_frame(ctx);\n}\n```\n\nThis pattern enables responsive layouts with proper component spacing and alignment.\n\n## Components\n\n| Category   | Components |\n|------------|------------|\n| Basic      | Button, Slider, Divider, Segmented |\n| Input      | TextField, Checkbox, Radio, Switch, Dropdown |\n| Selection  | Chip (assist/filter/input/suggestion) |\n| Container  | Card, Scroll, Bottom sheet |\n| List       | One/two/three-line items |\n| Navigation | Top app bar, Tabs, Navigation rail/bar/drawer |\n| Action     | FAB, Icon buttons |\n| Feedback   | Progress, Snackbar, Tooltip, Badge, Banner |\n| Overlay    | Menu, Dialog, Date/Time picker |\n| Data       | Data table with sortable columns |\n\nThe file [tests/example.c](tests/example.c) demonstrates all 34 component types.\n\n## Layout\n\n```c\n/* Single column */\niui_button(ctx, \"First\", IUI_ALIGN_LEFT);\niui_button(ctx, \"Second\", IUI_ALIGN_LEFT);\n\n/* Flex: negative = ratio, positive = fixed px */\niui_flex(ctx, 3, (float[]){-1, 100, -2}, 40, 4);\niui_button(ctx, \"1/3\", IUI_ALIGN_LEFT);  iui_flex_next(ctx);\niui_button(ctx, \"100px\", IUI_ALIGN_LEFT); iui_flex_next(ctx);\niui_button(ctx, \"2/3\", IUI_ALIGN_LEFT);\niui_flex_end(ctx);\n\n/* Grid: 4 cols, 60x40 cells, 4px gap */\niui_grid_begin(ctx, 4, 60, 40, 4);\nfor (int i = 0; i \u003c 12; i++) {\n    iui_button(ctx, labels[i], IUI_ALIGN_CENTER);\n    iui_grid_next(ctx);\n}\niui_grid_end(ctx);\n```\n\n## Vector Graphics\nWhen `CONFIG_FEATURE_VECTOR` is enabled, libiui provides primitives for custom drawing:\n\n```c\n/* Draw a line from (x1,y1) to (x2,y2) */\niui_draw_line(ctx, x1, y1, x2, y2, color);\n\n/* Draw a circle at (cx,cy) with radius r */\niui_draw_circle(ctx, cx, cy, r, color);\n\n/* Draw an arc centered at (cx,cy) from angle start to end */\niui_draw_arc(ctx, cx, cy, r, start_angle, end_angle, color);\n```\n\nThese primitives enable custom icons, charts, gauges, and decorative elements while maintaining the immediate-mode philosophy.\n\n## Input\n\n```c\niui_update_mouse_pos(ctx, x, y);\niui_update_mouse_buttons(ctx, pressed_mask, released_mask);\niui_update_key(ctx, keycode);\niui_update_char(ctx, codepoint);\n```\n\n## Testing\n\n```shell\nmake check                           # 349 API tests\nmake check SANITIZERS=1              # AddressSanitizer\npython3 scripts/headless-test.py     # Automated UI tests\n```\n\n## License\nlibiui is available under a permissive MIT-style license.\nUse of this source code is governed by a MIT license that can be found in the [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysprog21%2Flibiui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsysprog21%2Flibiui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysprog21%2Flibiui/lists"}