{"action":"created","issue":{"url":"https://api.github.com/repos/drudru/ansi_up/issues/23","labels_url":"https://api.github.com/repos/drudru/ansi_up/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/drudru/ansi_up/issues/23/comments","events_url":"https://api.github.com/repos/drudru/ansi_up/issues/23/events","html_url":"https://github.com/drudru/ansi_up/issues/23","id":108467805,"number":23,"title":"dynamic class specification","user":{"login":"KrishnaPG","id":4610831,"avatar_url":"https://avatars.githubusercontent.com/u/4610831?v=3","gravatar_id":"","url":"https://api.github.com/users/KrishnaPG","html_url":"https://github.com/KrishnaPG","followers_url":"https://api.github.com/users/KrishnaPG/followers","following_url":"https://api.github.com/users/KrishnaPG/following{/other_user}","gists_url":"https://api.github.com/users/KrishnaPG/gists{/gist_id}","starred_url":"https://api.github.com/users/KrishnaPG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KrishnaPG/subscriptions","organizations_url":"https://api.github.com/users/KrishnaPG/orgs","repos_url":"https://api.github.com/users/KrishnaPG/repos","events_url":"https://api.github.com/users/KrishnaPG/events{/privacy}","received_events_url":"https://api.github.com/users/KrishnaPG/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-26T14:05:39Z","updated_at":"2015-10-22T23:26:49Z","closed_at":null,"body":"Thank you for sharing this. It is helpful.\r\n\r\nTwo concerns, though:\r\n\r\n1.    In the browser you are exposing `ansi_up` without exposing the underlying `Ansi_Up` class. Thus every time `escape_for_html` or `ansi_to_html` is called a new `Ansi_up` object is created, not an elegant solution while calling these methods on thousands of lines in a loop (template processing). Exposing the underlying class itself helps the caller to create the object once and call the methods multiple times.\r\n\r\n2. In some situation (read, templates processing again), the external pages will have predefined css styles for the color-classes. Manually editing them in your js file is not a maintainable solution.\r\n\r\nWould be great if you could expose an API to set the class names to override the default class names. For example, below is one example mapping (ansicode, class name). \r\n````\r\nansi_colormap = {\r\n    '30': 'ansiblack',\r\n    '31': 'ansired',\r\n    '32': 'ansigreen',\r\n    '33': 'ansiyellow',\r\n    '34': 'ansiblue',\r\n    '35': 'ansipurple',\r\n    '36': 'ansicyan',\r\n    '37': 'ansigrey',\r\n    '01': 'ansibold',\r\n}\r\n\r\nAnsi_up.setColorClasses(ansi_colormap ); // something like this\r\n````"},"comment":{"url":"https://api.github.com/repos/drudru/ansi_up/issues/comments/150383067","html_url":"https://github.com/drudru/ansi_up/issues/23#issuecomment-150383067","issue_url":"https://api.github.com/repos/drudru/ansi_up/issues/23","id":150383067,"user":{"login":"drudru","id":546,"avatar_url":"https://avatars.githubusercontent.com/u/546?v=3","gravatar_id":"","url":"https://api.github.com/users/drudru","html_url":"https://github.com/drudru","followers_url":"https://api.github.com/users/drudru/followers","following_url":"https://api.github.com/users/drudru/following{/other_user}","gists_url":"https://api.github.com/users/drudru/gists{/gist_id}","starred_url":"https://api.github.com/users/drudru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drudru/subscriptions","organizations_url":"https://api.github.com/users/drudru/orgs","repos_url":"https://api.github.com/users/drudru/repos","events_url":"https://api.github.com/users/drudru/events{/privacy}","received_events_url":"https://api.github.com/users/drudru/received_events","type":"User","site_admin":false},"created_at":"2015-10-22T23:26:49Z","updated_at":"2015-10-22T23:26:49Z","body":"Hi @KrishnaPG \r\n\r\nI thought more about this on a walk. I think your use case is not typical. I think the more common case is that someone will use a mapping from strings to strings. \r\n\r\nFor example, you could imagine a front-end dev working through a map that looks like this:\r\n\r\n```javascript\r\n    ansi_colormap = {\r\n      'ansi-black' : 'elflord-black',\r\n      'ansi-red'   : 'elflord-red',\r\n      'ansi-green' : 'elflord-green'\r\n    }\r\n```\r\n\r\nI think providing an api for that would be more humane."}}