{"id":13523100,"url":"https://gitlab.com/jallbrit/cbonsai","last_synced_at":"2025-10-06T20:19:20.763Z","repository":{"id":54393274,"uuid":"18809822","full_name":"jallbrit/cbonsai","owner":"jallbrit","description":"grow bonsai trees in your terminal","archived":false,"fork":false,"pushed_at":null,"size":null,"stargazers_count":383,"open_issues_count":8,"forks_count":39,"subscribers_count":null,"default_branch":"master","last_synced_at":"2025-09-15T21:48:01.921Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0+","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":null,"metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-15T21:40:05.649Z","updated_at":"2025-07-25T09:59:05.961Z","dependencies_parsed_at":"2022-08-17T18:05:14.848Z","dependency_job_id":null,"html_url":"https://gitlab.com/jallbrit/cbonsai","commit_stats":{"total_commits":124,"total_committers":17,"mean_commits":7.294117647058823,"dds":0.5725806451612903,"last_synced_commit":"50fe627c84036e3be4115b02be04d17f58480199"},"previous_names":[],"tags_count":11,"template":null,"template_full_name":null,"purl":"pkg:gitlab/jallbrit/cbonsai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/jallbrit%2Fcbonsai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/jallbrit%2Fcbonsai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/jallbrit%2Fcbonsai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/jallbrit%2Fcbonsai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/owners/jallbrit","download_url":"https://gitlab.com/jallbrit/cbonsai/-/archive/master/cbonsai-master.zip","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/jallbrit%2Fcbonsai/sbom","scorecard":null,"host":{"name":"gitlab.com","url":"https://gitlab.com","kind":"gitlab","repositories_count":4520872,"owners_count":7229,"icon_url":"https://github.com/gitlab.png","version":null,"created_at":"2022-05-30T11:31:42.605Z","updated_at":"2024-07-18T11:24:13.055Z","status":"online","status_checked_at":"2025-10-06T02:00:06.106Z","response_time":459,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.382Z","robots_txt_url":"https://gitlab.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/owners"}},"keywords":[],"created_at":"2024-08-01T06:00:55.504Z","updated_at":"2025-10-06T20:19:20.756Z","avatar_url":null,"language":null,"funding_links":[],"categories":["Terminal","\u003ca name=\"animation\"\u003e\u003c/a\u003eAnimation","Packages","Random Cool Stuff","Table of Contents"],"sub_categories":["Fancies","Show off scripts"],"readme":"# cbonsai\n\n\u003cimg src=\"https://i.imgur.com/rnqJx3P.gif\" align=\"right\" width=\"400px\"\u003e\n\n`cbonsai` is a bonsai tree generator, written in `C` using `ncurses`. It intelligently creates, colors, and positions a bonsai tree, and is entirely configurable via CLI options-- see [usage](#usage). There are 2 modes of operation: `static` (see finished bonsai tree), and `live` (see growth step-by-step).\n\n`cbonsai` is always looking for ideas for improvement- feel free to open an issue if you've got an idea or a bug!\n\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\n## Installation\n\n\u003ca href=\"https://repology.org/project/cbonsai/versions\"\u003e\n    \u003cimg src=\"https://repology.org/badge/vertical-allrepos/cbonsai.svg\" alt=\"Packaging status\" align=\"right\"\u003e\n\u003c/a\u003e\n\n`cbonsai` is available in multiple repositories. Check the repology chart to the right to see if `cbonsai` is packaged for your system. A big thank you to all the people who packaged `cbonsai`!\n\nIf no package exists for your system/distribution, you'll have to use the [manual](https://gitlab.com/jallbrit/cbonsai#manual) install instructions. Below are some more specific instructions for some distributions.\n\n### Debian-based\n\n`cbonsai` is available in Debian Testing and Unstable via `apt`. Robin Gustafsson has also kindly packaged `cbonsai` as a `.deb` file over in [this repository](https://gitlab.com/rgson/debian_cbonsai/-/packages).\n\n### Fedora\n\nMohammad Kefah has kindly packaged `cbonsai` in the [Fedora copr](https://copr.fedorainfracloud.org/), which is \"similar to what the AUR is to Arch\". On Fedora, it can be installed like so:\n\n```bash\nsudo dnf copr enable keefle/cbonsai\nsudo dnf install cbonsai\n```\n\n### MacOS\n\nYou may install `cbonsai` using [Homebrew](https://brew.sh):\n\n```bash\nbrew install cbonsai\n```\n\nYou may also install `cbonsai` using [MacPorts](https://www.macports.org). Simply install MacPorts, then issue the following commands:\n\n```bash\nsudo port selfupdate\nsudo port install cbonsai\n```\n\n### Manual\n\nYou'll need to have a working `ncursesw`/`ncurses` library.\n\n#### Debian-based\n\n```bash\nsudo apt install libncursesw5-dev\n```\n\n#### Fedora\n\n```bash\nsudo dnf install ncursesw5-devel\n```\n\n#### macOS\n\nFollow the [Manual](#manual) installation, but if you install `ncurses` via homebrew, you may see this:\n\n```\nFor pkg-config to find ncurses you may need to set:\n  set -gx PKG_CONFIG_PATH \"/usr/local/opt/ncurses/lib/pkgconfig\"\n```\n\nYou may need to follow these instructions before running `make install`.\n\nIf you are having trouble installing on MacOS, try reading [this issue](https://gitlab.com/jallbrit/cbonsai/-/issues/10).\n\nOnce dependencies are met, then install:\n\n```bash\ngit clone https://gitlab.com/jallbrit/cbonsai\ncd cbonsai\n\n# install for this user\nmake install PREFIX=~/.local\n\n# install for all users\nsudo make install\n```\n\n## Usage\n\n```\nUsage: cbonsai [OPTION]...\n\ncbonsai is a beautifully random bonsai tree generator.\n\nOptions:\n  -l, --live             live mode: show each step of growth\n  -t, --time=TIME        in live mode, wait TIME secs between\n                           steps of growth (must be larger than 0) [default: 0.03]\n  -i, --infinite         infinite mode: keep growing trees\n  -w, --wait=TIME        in infinite mode, wait TIME between each tree\n                           generation [default: 4.00]\n  -S, --screensaver      screensaver mode; equivalent to -liWC and\n                           quit on any keypress\n  -m, --message=STR      attach message next to the tree\n  -b, --base=INT         ascii-art plant base to use, 0 is none\n  -c, --leaf=LIST        list of comma-delimited strings randomly chosen\n                           for leaves\n  -k, --color=LIST       list of 4 comma-delimited color indices (0-255) for\n                           each of dark leaves, dark wood, light leaves, and\n                           light wood, in that order [default: 2,3,10,11]\n  -M, --multiplier=INT   branch multiplier; higher -\u003e more\n                           branching (0-20) [default: 5]\n  -L, --life=INT         life; higher -\u003e more growth (0-200) [default: 32]\n  -p, --print            print tree to terminal when finished\n  -s, --seed=INT         seed random number generator\n  -W, --save=FILE        save progress to file [default: ~/.cache/cbonsai]\n  -C, --load=FILE        load progress from file [default: ~/.cache/cbonsai]\n  -v, --verbose          increase output verbosity\n  -h, --help             show help\n```\n\n## Tips\n\n### Screensaver Mode\n\nTry out `-S/--screensaver` mode! As the help message states, it activates the `--live` and `--infinite` modes, quits upon any keypress, also saves/loads using the default cache file (`~/.cache/cbonsai`). This means:\n\n* When you start `cbonsai` with `--screensaver`, a tree (including its seed and progress) is loaded from the default cache file.\n* When you quit `cbonsai` and `--screensaver` was on, the current tree being generated (including its seed and progress) is written to the default cache file.\n\nThis is helpful for a situations like the following: let's say you're growing a really big tree, really slowly:\n\n```bash\n$ cbonsai --life 40 --multiplier 5 --time 20 --screensaver\n```\n\nNormally, when you quite `cbonsai` (e.g. by you hitting `q` or `ctrl-c`), you would lose all progress on that tree. However, by specifying `--screensaver`, the tree is automatically saved to a cache file upon quitting. The next time you run that exact same screensaver command:\n\n```bash\n$ cbonsai --life 40 --multiplier 5 --time 20 --screensaver\n```\n\nThe tree is automatically loaded from the cache file! And, since infinite mode is automatically turned on, it will finish the cached tree and just keep generating more. When you quit `cbonsai` again, the tree is once again written to the cache file for next time.\n\nKeep in mind that only the seed and number of branches are written to the cache file, so if you want to continue a previously generated tree, make sure you re-specify any other options you may have changed.\n\n### Add to `.bashrc`\n\nFor a new bonsai tree every time you open a terminal, just add the following to the end of your `~/.bashrc`:\n\n```bash\ncbonsai -p\n```\n\nNotice it uses the print mode, so that you can immediately start typing commands below the bonsai tree.\n\n### Infinite Mode With `fortune` or Similar\n\nIf you want to run `cbonsai --infinite --message $(fortune)`, you'll quickly notice that `fortune` only runs once, and the same message is on each tree. What if you could run `fortune` each time, for a fresh message? Or some other program that gives you text?\n\n`cbonsai` does not include an \"--exec\" feature, but you can emulate this functionality by wrapping `cbonsai` in a bash script, like the one below:\n\n```bash\n#!/bin/bash\nWAITTIME=15\n\nclear\n\nwhile true; do\n\techo -ne \"\\e[?25l\"\n\ttimeout -f \"$WAITTIME\" ./cbonsai -m \"$(fortune)\"    # --live also works\n\techo -ne \"\\e[?25l\"\n\tsleep 2\ndone\n```\n\nThis script uses an ANSI escape sequence to hide the cursor, then runs `cbonsai`, using `timeout` to kill the process after `$WAITTIME` seconds. Then, it sleeps for 2 seconds, and starts another tree.\n\n## How it Works\n\n`cbonsai` starts by drawing the base onto the screen, which is basically just a static string of characters. To generate the actual tree, `cbonsai` uses a ~~bunch of if statements~~ homemade algorithm to decide how the tree should grow every step. Shoots to the left and right are generated as the main trunk grows. As any branch dies, it branches out into a bunch of leaves.\n\n`cbonsai` has rules for which character and color it should use for each tiny branch piece, depending on things like what type of branch it is and what direction it's facing.\n\nThe algorithm is tweaked to look best at the default size, so larger sized trees may not be as bonsai-like.\n\n## Inspiration\n\nThis project wouldn't be here if it weren't for its *roots*! `cbonsai` is a newer version of [bonsai.sh](https://gitlab.com/jallbrit/bonsai.sh), which was written in `bash` and was itself a port of [this bonsai tree generator](https://avelican.github.io/bonsai/) written in `javascript`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/gitlab.com%2Fjallbrit%2Fcbonsai","html_url":"https://awesome.ecosyste.ms/projects/gitlab.com%2Fjallbrit%2Fcbonsai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/gitlab.com%2Fjallbrit%2Fcbonsai/lists"}