Change line colors / use mystyle.less


#1

Hello everybody,

i’m new to Atom and want to create a package that colorizes a specific log format that i have to use.

to start simple, i just want to change the color of selected textlines:

var editor = atom.workspace.getActiveTextEditor();
var range = editor.getSelectedBufferRange();
var trace_marker = editor.markBufferRange(range); //editor.markBufferRange(syslog_lines.trace);
var decoration = editor.decorateMarker(trace_marker, {type: 'line', class: 'my-line-class'});

in my project style file, i’ve included the following css class

.my-line-class {
    background-color: red;
    color: white;
}

i’ve also added this to my styles.less file to make sure that the class is there, because i don’t even know if my package style file is loaded :frowning: .

now when i toggle my package after i’ve selected some text, the color doesn’t change, but i see that my-line-class was added (via dev tools).

Could someone please describe the prefered way to colorize the editor content?


#2

See the FAQ on how to create a language package: