{"id":19489407,"url":"https://github.com/1j01/ascii-hypercube","last_synced_at":"2025-06-16T05:33:54.908Z","repository":{"id":53729173,"uuid":"89114673","full_name":"1j01/ascii-hypercube","owner":"1j01","description":"Make ASCII art with ＨＹＰＥＲＲＥＣＴＡＮＧＬＥＳ","archived":false,"fork":false,"pushed_at":"2024-10-20T04:43:27.000Z","size":215,"stargazers_count":24,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-21T02:45:25.180Z","etag":null,"topics":["aesthetic","aesthetics","ascii","ascii-art","experiment","geometry","hypercube","tesseract","text-generator"],"latest_commit_sha":null,"homepage":"https://1j01.github.io/ascii-hypercube/","language":"JavaScript","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/1j01.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":"2017-04-23T03:27:02.000Z","updated_at":"2025-02-24T14:04:57.000Z","dependencies_parsed_at":"2022-09-22T04:53:23.777Z","dependency_job_id":null,"html_url":"https://github.com/1j01/ascii-hypercube","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1j01%2Fascii-hypercube","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1j01%2Fascii-hypercube/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1j01%2Fascii-hypercube/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1j01%2Fascii-hypercube/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1j01","download_url":"https://codeload.github.com/1j01/ascii-hypercube/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250882388,"owners_count":21502300,"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":["aesthetic","aesthetics","ascii","ascii-art","experiment","geometry","hypercube","tesseract","text-generator"],"created_at":"2024-11-10T21:08:26.990Z","updated_at":"2025-04-25T19:30:32.654Z","avatar_url":"https://github.com/1j01.png","language":"JavaScript","readme":"# ＡＳＣＩＩ　ＨＹＰＥＲＣＵＢＥ\nCreate word cubes and other [hyperrectangular] ASCII art.\n\n[Try it out `ｏｎｌｉｎｅ` on this `ｗｅｂｐａｇｅ`｡](https://1j01.github.io/ascii-hypercube/)\n\n[hyperrectangular]: https://en.wikipedia.org/wiki/Hyperrectangle\n\n## Examples\n\n### 1D\n\n    N O T   V E R Y   I N T E R E S T I N G\n\nIf you want actual wide text, use [Vaporwave Text Generator](https://lingojam.com/VaporwaveTextGenerator).\n\n### 2D\n\n    S Q U A R E S    O N E → T W O    ONE→TWO\n    Q           Q    N           N    N     N\n    U   M E H   U    E           E    E     E\n    A   E   E   A    ↓           ↓    ↓     ↓\n    R   H E H   R    T           T    T     T\n    E           E    W           W    W     W\n    S Q U A R E S    O N E → T W O    ONE→TWO\n    \n    T Y P E S E T    T E X T    T Y P E S E T\n    E           E    E     E    E           E\n    S           S    S     S    X           X\n    T Y P E S E T    T E X T    T Y P E S E T\n\n### 3D\n\n    H A H   Y E A H\n    A\\            A\\\n    H H A H   Y E A H\n      A             A        C U B I C\n    Y H           Y H      / U     / U\n    E             E      C U B I C   B\n    A Y           A Y    U   I   U   I\n    H E H   Y E A H E    B   C U B I C\n     \\A            \\A    I /     I /\n      H A H   Y E A H    C U B I C\n\n### 4D\n\n    T E S S E R A C T\n    E\\ .            E\\ .\n    S \\   .         S \\   .\n    S  \\     .      S  \\     .\n    E   \\       T E S S E R A C T\n    R    T E S SE\\ RRA C T      E\\\n    A    E  .   S \\ A    E  .   S \\\n    C    S     .S  \\C    S     .S  \\\n    T E SSS E R E C \\    S      E . \\\n     \\ . E      R    T E S S E RRA C T\n      \\  R.     A    E\\  R.     A    E\n       \\ A   .  C    S \\ A   .  C    S\n        \\C      T E SSS ECR A C T    S\n         T E S S \\ R E C T       \\   E\n            .     \\  R      .     \\  R\n               .   \\ A         .   \\ A\n                  . \\C            . \\C\n                     T E S S E R A C T\n\n### 5D\n\n       R A T H E R   H Y P E R\n      /A\\ ~                 /A\\ ~\n     / T \\   ~             / T \\   ~\n    R AHT H E R ~ H Y P E R  H  \\     ~\n    A\\ ~   R A T H E R   HA\\ ~ E R       ~\n    T \\R  ~A  ~       ~   T \\R  ~A  ~       ~\n    H  \\ / T ~   ~       ~H  \\ / T ~   ~       ~\n    E  HR AHT H E R ~ H Y P EHR  H    ~   ~       ~\n    R  YA  ~       ~   ~  R  YAR ~ T H E ~   H Y P E R\n       PT  R  ~       ~   ~  PTA\\R  ~       ~   ~   /A\\\n    H  EH        ~       ~H  EHT \\     ~       ~   ~ T \\\n    Y  REA H H E R  ~H Y PYERRAHTHH E R   H Y P E R  H~ \\\n    P / R ~Y           ~  P A\\RE~Y R A T H E ~   HA\\ P E R\n    E/   \\ P ~            E/T \\R P/A            ~ T \\R  /A\n    R A H HEE R ~ H Y P E R H~H\\\\E T  ~           H~ \\ / T\n     \\ ~Y  R A T H E R   H \\E~YHRRAHT H E~R   H Y P EHR  H\n      \\ P ~   ~       ~     R PYA  E~       ~     R  YA  E\n       \\E/   ~   ~       ~   \\EPT  ~   ~       ~     PT  R\n        R A T H E R ~ H Y P H REH     ~   ~       H  EH\n           ~       ~   ~    Y  RE~ H H E ~   H Y PYE RE  H\n              ~       ~   ~ P / R  Y~       ~   ~ P / R  Y\n                 ~       ~  E~   \\ P   ~       ~  E~   \\ P\n                    ~       R A H HEE R   H Y P E R   H \\E\n                       ~     \\  Y  R A T H E ~   H \\ PYE R\n                          ~   \\ P /             ~   \\ P /\n                             ~ \\E/                 ~ \\E/\n                                R A T H E R   H Y P E R\n\n## Library Usage\n\nInstall with npm:\n\n```sh\nnpm install ascii-hypercube\n```\n\nUse in your code:\n```js\nconst { renderHypercube } = require('ascii-hypercube')\n\nconst dimensions = [\n  { length: 4, xPerGlyph: 2, yPerGlyph: 0, text: \"CUBIC\" },\n  { length: 4, xPerGlyph: 0, yPerGlyph: 1, text: \"CUBIC\" },\n  { length: 2, xPerGlyph: -2, yPerGlyph: 1, text: \"/\" },\n];\nconst { text, numOverlaps, overlaps } = renderHypercube(dimensions);\n\nconsole.log(text);\n```\n\nIf you want to use the browser version, you can include the [script](https://unpkg.com/ascii-hypercube) in your HTML:\n\n```html\n\u003cscript src=\"ascii-hypercube.js\"\u003e\u003c/script\u003e\n```\n\nand it will define a global `renderHypercube` function.\n\n## API\n\n### `renderHypercube(dimensions: Dimension[], splitter?: GraphemeSplitter): { text: string, numOverlaps: number, overlaps: OverlapStats }`\n\n- `dimensions` is an array of objects with the following properties:\n  - `length` is the number of steps **between** the first and last glyph along the dimension. It should be one less than the number of glyphs to be plotted.\n  - `xPerGlyph` is the number of characters to move right for each plotted glyph\n  - `yPerGlyph` is the number of characters to move down for each plotted glyph\n  - `text` is the text to render along edges of the dimension. It is repeated if `length` is greater than **or equal to** the length of the text.\n  - `glyphs` is an alternative to `text` if you have already split the text into graphemes. Exactly one of `text` or `glyphs` should be provided.\n\n- `splitter` is an optional [GraphemeSplitter](https://github.com/orling/grapheme-splitter) object with a `splitGraphemes` method.\n  - When loaded in a browser, the library will try to use the global `GraphemeSplitter` if available.\n  - In Node.js, `grapheme-splitter` is included as a dependency and will be used automatically.\n  - If you want to use a different library or a custom implementation, you can pass it in here.\n\n- Returns an object with the following properties:\n  - `text` is the rendered hypercube as a string\n  - `numOverlaps` is the number of times a glyph was plotted that didn't match the glyph that was already there\n  - `overlaps` is an object that gives statistics about the overlaps.\n    - Each key is a glyph that was overwritten, and each value is an object with keys being overriding glyphs and values being the number of times that overlap occurred.\n\n## CLI\n\nYou can also use the command-line interface. If you have Node.js installed, you can simply use `npx` to run it:\n\n```sh\nnpx ascii-hypercube -d 2,0 3 'TEST' -d 0,1 3 'TEXT' -d -1,1 4 '///'\n```\n\nTo install as a global command:\n\n```sh\nnpm install -g ascii-hypercube\n```\n\nThen you can run it without `npx`.\n\n```HELP_OUTPUT\nusage: ascii-hypercube [-h] [-d TRAVEL LENGTH TEXT] [-s]\n\nCLI to render hypercubes with text along an arbitrary number of dimensions\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -d TRAVEL LENGTH TEXT, --dimension TRAVEL LENGTH TEXT\n                        Define a dimension, with travel per glyph, length of\n                        edges along the dimension, and text. Can be specified\n                        multiple times. Travel must be given as a pair of\n                        numbers with no spaces, e.g. \"-1,0\" or \"(-1,0)\"\n  -s, --stats           Print statistics about the overlaps\n\nExample: ascii-hypercube -d 2,0 11 'RATHER HYPER' -d 0,1 11 'RATHER HYPER' -d\n1,1 4 '\\\\' -d 3,1 8 '\\~' -d -1,1 3 '\\/'\n```\n\n## Development\n\nThis project is written in CoffeeScript.\n\n### Library\n\nAdd tests to [`src/test.js`](src/test.js) and run them with:\n```sh\nnpm test\n```\n\n### Web App\n\nAny static file server will do. One that auto-reloads is nice:\n```sh\nnpx live-server .\n```\n\n### CLI\n\nUpdate help in this readme with:\n```sh\nnpm run update-cli-docs\n```\n\n## License\n\nMIT-licensed; see [LICENSE](LICENSE) for details\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1j01%2Fascii-hypercube","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1j01%2Fascii-hypercube","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1j01%2Fascii-hypercube/lists"}