Dynamically changing cursor color from package config


I’m writing a package that changes the pipe cursor to a block cursor, like some terminal emulators have. It uses the @syntax-cursor-color variable from the currently selected syntax theme by default, but this may very well be extremely annoying (white text on a white cursor etc.).

To solve this I added a config option to the package, so this behavior can be overridden. To do this, I would like to dynamically change a rule in the packages stylesheet, but is there a way to get the packages stylesheet? Or is there another preferred way of doing such a thing?



See the @import statements at the top of my styles.less for examples:

Or, if you’re trying to get to the contents of your package directory from your code, you can use atom.packages.resolvePackagePath.


Thanks for the reply! I was actually referring to getting the <style> element of my package’s stylesheet with javascript though. In the end I created a new <style> element which I appended to the <atom-styles> in the <head> of the document. I can then change the rules of that stylesheet.

This is the result.