{"id":17797482,"url":"https://github.com/wolfadex/elm-ansi","last_synced_at":"2025-03-17T04:31:38.747Z","repository":{"id":62078535,"uuid":"546726457","full_name":"wolfadex/elm-ansi","owner":"wolfadex","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-27T20:49:19.000Z","size":500,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-28T06:27:29.433Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wolfadex.png","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":"2022-10-06T14:43:56.000Z","updated_at":"2024-05-27T21:02:19.000Z","dependencies_parsed_at":"2023-02-18T17:45:34.885Z","dependency_job_id":null,"html_url":"https://github.com/wolfadex/elm-ansi","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfadex%2Felm-ansi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfadex%2Felm-ansi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfadex%2Felm-ansi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfadex%2Felm-ansi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wolfadex","download_url":"https://codeload.github.com/wolfadex/elm-ansi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221671807,"owners_count":16861312,"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":"2024-10-27T11:56:04.486Z","updated_at":"2024-10-27T11:56:05.067Z","avatar_url":"https://github.com/wolfadex.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# elm-ansi\n\nA low-level package for text formatting and layout for your terminal.\n\n## Who is this for?\n\nThis package is meant as a building block for more expressive packages. You can think of it like [elm/virtual-dom](https://package.elm-lang.org/packages/elm/virtual-dom/latest/) for [elm/html](https://package.elm-lang.org/packages/elm/html/latest/) and [mdgriffith/elm-ui](https://package.elm-lang.org/packages/mdgriffith/elm-ui/latest/).\n\n## Examples\n\n### Hello World\n\n```elm\nport module Main exposing (..)\n\nimport Ansi\nimport Ansi.Cursor\nimport Ansi.Font\nimport Platform\n\n\ninit _ =\n    ( ()\n    , [ Ansi.Font.resetAll\n      , Ansi.clearScreen\n      , Ansi.Cursor.moveTo { row = 1, column = 1 }\n      , \"🌈 Hello, \" ++ Ansi.Font.bold \"world\" ++ \"!\"\n      ]\n        |\u003e String.concat\n        |\u003e stdout\n    )\n\n\nstdout : String -\u003e Cmd msg\n\n\nmain =\n    Platform.worker\n        { init = init\n        , subscriptions = \\_ -\u003e Sub.none\n        , update = \\_ model -\u003e ( model, Cmd.none )\n        }\n```\n\nif printed to a terminal would give you\n\n\u003e 🌈 Hello, **World**!\n\nWalking through this step-by-step:\n\n1. With `Ansi.Font.resetAll` we reset all of the font settings, removing and styles that might be left over.\n1. Then we use `Ansi.clearScreen` to, clear the screen.\n1. At this point our cursor is still wherever we left it so we move it to the top left most corner with `Ansi.Cursor.moveTo { row = 1, column = 1 }`.\n1. Now we can finally start drawing our content! We want to write out `\"🌈 Hello, World!\"`, but we also want to make `World` bold.\n1. Finally we join all of this together and send it out through a port!\n\n### Hello World++\n\nFor more complete example including handling input, checkout the examples directory [in the repo](https://github.com/wolfadex/elm-ansi).\n\n### A simple game\n\nFor a more production like example, check out [micro-dungeon](https://github.com/wolfadex/micro-dungeon).\n\n---\n\n## Contributing\n\n- Install [Nix](https://nixos.org/download.html) and [direnv](https://direnv.net/)\n- Clone this repo\n- Inside your cloned repo, run `direnv allow`\n\nor\n\n- Install [Node.js](https://nodejs.org/en/) and [Em](https://elm-lang.org/)\n- Clone this repo\n- Inside the cloned repo, run `npm install`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwolfadex%2Felm-ansi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwolfadex%2Felm-ansi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwolfadex%2Felm-ansi/lists"}