{"id":13554452,"url":"https://github.com/juliuste/colorize-transit-graph","last_synced_at":"2025-10-31T07:31:24.517Z","repository":{"id":57203460,"uuid":"143004640","full_name":"juliuste/colorize-transit-graph","owner":"juliuste","description":"Add “random” line colors to a given transit graph.","archived":false,"fork":false,"pushed_at":"2020-05-25T04:12:49.000Z","size":39,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-26T09:47:51.067Z","etag":null,"topics":["library","public-transport"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juliuste.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":"2018-07-31T11:22:34.000Z","updated_at":"2019-06-14T15:52:42.000Z","dependencies_parsed_at":"2022-09-17T06:30:50.337Z","dependency_job_id":null,"html_url":"https://github.com/juliuste/colorize-transit-graph","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/juliuste%2Fcolorize-transit-graph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fcolorize-transit-graph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fcolorize-transit-graph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fcolorize-transit-graph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juliuste","download_url":"https://codeload.github.com/juliuste/colorize-transit-graph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239139709,"owners_count":19588246,"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":["library","public-transport"],"created_at":"2024-08-01T12:02:48.139Z","updated_at":"2025-10-31T07:31:19.207Z","avatar_url":"https://github.com/juliuste.png","language":"JavaScript","readme":"# colorize-transit-graph\n\nAdd “random” line colors to a given transit graph, e.g. generated using [`osm-transit-graph`](https://github.com/juliuste/osm-transit-graph).\n\n[![npm version](https://img.shields.io/npm/v/colorize-transit-graph.svg)](https://www.npmjs.com/package/colorize-transit-graph)\n[![Build Status](https://travis-ci.org/juliuste/colorize-transit-graph.svg?branch=master)](https://travis-ci.org/juliuste/colorize-transit-graph)\n[![Greenkeeper badge](https://badges.greenkeeper.io/juliuste/colorize-transit-graph.svg)](https://greenkeeper.io/)\n[![dependency status](https://img.shields.io/david/juliuste/colorize-transit-graph.svg)](https://david-dm.org/juliuste/colorize-transit-graph)\n[![license](https://img.shields.io/github/license/juliuste/colorize-transit-graph.svg?style=flat)](license)\n[![chat on gitter](https://badges.gitter.im/juliuste.svg)](https://gitter.im/juliuste)\n\n## Installation\n\n```shell\nnpm install -g colorize-transit-graph\n```\n\n## Usage\n\nThe library will add `color` attributes to all lines / line groups that don't yet have color information. Existing colors will be conserved.\n\nThe output graph could then be drawn by using [`svg-transit-map`](https://github.com/juliuste/svg-transit-map).\n\n### CLI\n\n```shell\nUsage:\n    cat graph.json | colorize-transit-graph \u003e colorized-graph.json\n```\n\nWhere `graph.json` containts a graph object with three attributes:\n\n```js\n{\n    nodes: [ // list of all nodes\n        {\n            id: \"900000042101\", // required\n            metadata: {\n                x: 537.029, // x-coordinate in any metric, required\n                y: 673.576 // y-coordinate in any metric, required, see also the --invert-y option\n            }\n        }\n        // …\n    ],\n    edges: [ // list of all edges\n        {\n            // the direction of the edge will be ignored, source and target are therefore interchangeable\n            source: \"900000120025\", // node id, required\n            target: \"900000120008\", // node id, required\n            metadata: {\n                lines :[\"U5\",\"U6\"] // list of line ids, required. please note that parallel lines must be modeled as one edge with two metadata.lines entries\n            }\n        }\n        // …\n    ],\n    lines: [ // additional information for lines. if lines are not found in this list, default colour / group will be applied\n        {\n            id: 'U6', // line id, required\n            color: '#456', // line colour, optional. existing information will be conserved\n            group: 'U6' // line group id, optional. lines with the same group id will be merged info one for sections where they run in parallel\n        }\n        // …\n    ]\n}\n```\n\n### As a library\n\nThe module can be used as a JS library:\n\n```js\nconst colorizeTransitGraph = require('colorize-transit-graph')\nconst graph = require('./graph.json') // your transit graph\n\nconst colorized = colorizeTransitGraph(graph)\n```\n\n## Example\n\nGraphs drawn using [`svg-transit-map`](https://github.com/juliuste/svg-transit-map).\n\n```shell\n    cat example/berlin-input.json | colorize-transit-graph \u003e example/berlin-output.json\n    cat example/berlin-output.json | svg-transit-map \u003e example/berlin-output.svg\n```\n\n## Input\n\n![Berlin subway transit map with some color information](example/berlin-input.svg)\n\n## Output\n\n![Berlin subway transit map fully colorized](example/berlin-output.svg)\n\n\n## Contributing\n\nIf you found a bug or want to propose a feature, feel free to visit [the issues page](https://github.com/juliuste/colorize-transit-graph/issues).\n","funding_links":[],"categories":["JavaScript","library"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliuste%2Fcolorize-transit-graph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliuste%2Fcolorize-transit-graph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliuste%2Fcolorize-transit-graph/lists"}