{"id":25707339,"url":"https://github.com/shade40/Celadon","last_synced_at":"2025-02-25T08:06:08.595Z","repository":{"id":196464097,"uuid":"617585567","full_name":"shade40/Celadon","owner":"shade40","description":"A modern TUI library taking the right lessons from the web.","archived":false,"fork":false,"pushed_at":"2024-04-25T10:17:57.000Z","size":871,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-04-26T00:34:57.802Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/shade40.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2023-03-22T17:35:14.000Z","updated_at":"2024-04-25T10:18:01.000Z","dependencies_parsed_at":"2023-11-07T13:31:40.349Z","dependency_job_id":"e6c9fb37-8001-4c81-8c7f-eab4a633d999","html_url":"https://github.com/shade40/Celadon","commit_stats":null,"previous_names":["shade40/celadon"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shade40%2FCeladon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shade40%2FCeladon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shade40%2FCeladon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shade40%2FCeladon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shade40","download_url":"https://codeload.github.com/shade40/Celadon/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240627959,"owners_count":19831599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-02-25T08:02:44.164Z","updated_at":"2025-02-25T08:06:08.567Z","avatar_url":"https://github.com/shade40.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"![Celadon](https://singlecolorimage.com/get/afe1af/1600x200)\n\n## Celadon\n\nA modern TUI library taking the right lessons from the web.\n\n```\npip install sh40-celadon\n```\n\n![rule](https://singlecolorimage.com/get/afe1af/1600x3)\n\n### Development Note\n\nSince the project is in early stages a lot of optimization remains on\nthe table. It already runs well on most machines, but certain domains\n(such as styling \u0026 layouts) might hog older computers.\n\nThis will be remedied in the future, once the related framework is in\nplace to allow for more generalized testing.\n\n![rule](https://singlecolorimage.com/get/afe1af/1600x3)\n\n### Purpose\n\n`Celadon` is a _library_ for creating good looking and performant\nUIs in the terminal. While it _is_ possible to use standalone,\nyou generally wanna use it through a _framework_ like\n[celx](https://github.com/shade40/celx).\n\n![rule](https://singlecolorimage.com/get/afe1af/1600x3)\n\n### Feature highlights\n\n#### YAML Styling\n\n`Celadon` includes a powerful CSS-inspired engine for styling your\napplications. It supports your basic `#id`, `.group` (`.class` in CSS\nland) selector primitives, as well as direct (`Parent \u003e Widget`) and\nindirect hierarchal matching (`Parent *\u003e Widget`, where `Widget` is a\npart of `Parent` but not necessarily a first-degree descendant).\n\nIt replaces CSS' notion of a 'pseudoclass' with a more direct notion\nof widget _state_, controlled by a state machine internal to all widgets.\n\n```yaml\nButton:\n    fill_style: '@ui.primary'\n    # Automatically use either white or black, based on the W3C contrast\n    # guidelines\n    content_style: ''\n\n    # On hover, become a bit brighter\n    /hover: # Equivalent to 'Button/hover'\n        fill_style: '@ui.primary+1'\n\n    # Become a bit taller if in the 'big' group\n    .big:\n        height: 3\n\n    # If part of a Row in the 'button-row' group, fill available width.\n    # '\u0026' stands for the selector in the previous nesting layer, `Button`\n    # in this case.\n    Row.button-row \u003e \u0026:\n        width: null\n```\n\n#### A great layout system\n\nLayouts are one of the biggest difficulties in any UI environment,\nespecially on the web. We try to solve most of these issues by stripping\ndown the amount of settings _you_ need to be aware of (no more \"`align-items`\nor `justify-items`?\") and controlling almost all layout parameters within\nwidget dimension settings.\n\nA dimension can be one of three types:\n\n- `int`: Sets a static size, i.e. `button.width = 5` will make that button\n    take up 5 cells of space horizontally, regardless of its parent's size.\n- `float`: Sets a relative size to the parent's size of the same dimension,\n    i.e. `button.width = 0.5` will make the button be half the width of the\n    parent.\n- `None`: Sets a so-called `fill` height, meaning the parent will divide\n    its space remaining after sizing the widgets with the previous two\n    dimension types, and divide it evenly amongst the `fill` sized.\n\n**Exhibit A: Traditional 'web' Header-Body-Footer layout**\n\n```python\napp += Page(\n    Tower(\n        Row(\n            Text(\"I mimick the web\"),\n            Text(\"For it cannot mimick me\"),\n            eid=\"header\",\n        ),\n        Tower(Text.lorem(), eid=\"body\", group=\"center\"),\n        Row(\n            Button(\"Ctrl-C : Quit\"),\n            Button(\"F12 : Screenshot\"),\n            eid=\"footer\",\n        ),\n    ),\n    rules=\"\"\"\n    Tower#body:\n        frame: [null, heavy, null, heavy]\n\n    Row#header, Row#footer:\n        alignment: [center, start]\n        height: 1\n\"\"\",\n)\n```\n\nHere, specifying a static dimension for both header and footer's height\nallows the body to fill up the remaining space, and not specifying a width\nfor either (leaving it to the default `None`) makes them take up the entire\nwidth.\n\n**Exhibit B: N*K grid**\n\nBy making use of the `fill` dimension type, we can create responsive grids\nthat work regardless of the amount of widgets we have in each column / row.\n\n```python\nrows, cols = [10] * 2\ngrid = Tower(eid=\"grid\")\n\nfor _ in range(rows):\n    grid += Row(*[Button(\"Grid Item\") for _ in range(cols)])\n\napp += Page(\n    grid,\n    rules=\"\"\"\n    Tower#grid *\u003e Button:\n        width: null\n        height: null\n\n        # ...or, you could apply the pre-defined `fill` group to the widget\n        groups: [fill]\n\"\"\",\n)\n```\n\n![rule](https://singlecolorimage.com/get/afe1af/1600x3)\n\n### Documentation\n\nOnce the library gets to a settled state (near 1.0), documentation will be\nhosted both online and as a `celx` application. Until then peep the `examples`\nfolder, or check out some of the widget references by using `python3 -m pydoc \u003cname\u003e`.\n\n![rule](https://singlecolorimage.com/get/afe1af/1600x3)\n\n### See also\n\n- [Slate](https://github.com/shade40/slate): The terminal interfacing library that\n    forms much of `Celadon`'s backend.\n- [Zenith](https://github.com/shade40/zenith): The markup language \u0026 palette generator used\n    for styling content in `Celadon`.\n- [celx](https://github.com/shade40/celx): A hypermedia-driven TUI application framework\n    written on top of `Celadon`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshade40%2FCeladon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshade40%2FCeladon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshade40%2FCeladon/lists"}