Long time lurker, first time poster
I take notes using Sublime and while I have a custom sublime-syntax
and sublime-color-scheme
file to apply all the formatting I want, I’m stuck at this one complicated scenario involving code blocks.
Here’s what I have so far…
I used a
push
inside a match
¹ to apply JavaScript syntax highlighting to this code block (everything between <<
and >>
, the opening angled braces are styled differently on purpose; just playing around with the style.)
My problem:
I want to apply a dark background just for this code block. I can change the colors and styles for the keyword tokens inside the code using scopes but I can’t target just the background color for the code block alone, like so…
(sorry, new users can’t upload more than 1 image in post so that’s an external link to a mockup of what I’m aiming for.)
¹The relevant bit of sublime-syntax
:
- match: (<<)
captures:
1: post.code.start
push: Packages/JavaScript/JavaScript.sublime-syntax
with_prototype:
- match: (?=>>)
pop: true
- match: ">>"
scope: post.code.end
The relevant bit of sublime-color-scheme
:
{
"scope": "post.code.start",
"foreground": "var(gray1)",
"background": "var(gray5)",
},
{
"scope": "post.code.end",
"foreground": "var(gray1)",
"background": "#FFFFFF",
},
Is it possible to apply a dark color scheme just to this code block?
If not, what are my other options to change the background?
I can change the colors for the keywords albeit by tediously mapping JavaScript-related scopes to dark-themed colors in my color-scheme file, but I can’t even do that with the bg, nothing works there.