I want to create a very simple custom atom package where I highlight specific words based on regular expressions. I work with configuration files dealing with a large number of IP addresses. I want the color of the ip address 1.1.1.1 red, for example, 0.0.0.0 blue, etc.
So just creating a package, this is what I did:
Created file: C:\Users\MyUsername\.atom\packages\MyPackage\package.json
{ "name": "language-conf", "version": "0.0.1", "description": "Syntax highlighting for configuration files", "engines": { "atom": "*" } }
And the file: C:\Users\MyUsername\.atom\packages\MyPackage\grammars\rules.cson
'scopeName': 'source.conf' 'name': 'CONF' 'fileTypes': ['CONF'] 'patterns': [ { 'match': '1\.1\.1\.1' 'name': 'constant.numeric.integer.hexadecimal.python' }, { 'match': '0\.0\.0\.0' 'name': 'constant.numeric.integer.hexadecimal.python' } ]
When I open the configuration file, it looks like this:

Pay attention to how ips are formed, and that's great! How can I choose colors for different ips? All ips are yellow. It would be nice if instead of the name property there was a color property.
Edit
In short, I will like this example:
http://blog.gaku.net/create-a-custom-syntax-highlighting-with-atom-editor/
In this link, it does not show you how to put different colors / styles in different rules.
css packages atom-editor
Tono nam
source share