Sublime Text 3 - how do I make the sidebar black? - sublimetext

I can't seem to turn the sidebar black in Sublime 3. I have downloaded a few themes but the sidebar always stays the standard grey. How do you do it?

Open the .sublime-theme file for the theme you are interested in changing. It's likely wrapped up in a .sublime-package zip file in Installed Packages, so first install PackageResourceViewer from Package Control, which is an indispensable tool to have if you want to do any kind of hacking on Sublime's packages, either built-in or installed via Package Control. Once the plugin has been installed, open the Command Palette and type prv to bring up the PackageResourceViewer options. Select Extract Package, then scroll down the list until you find the name of the theme you installed. If you're simply using the default theme, it's called Theme - Default (easy enough to remember). Finally, go to Preferences -> Browse Packages... to bring up your Packages folder in your operating system's file browser - its location will vary by OS and installation type. Open the folder of your newly-extracted theme, and start editing the appropriate .sublime-theme file in Sublime, using JSON syntax for highlighting, if you prefer.
Now that we've got the actual file open, search for "class": "sidebar_container" (or just sidebar_container, it should be unique), and take a look at it. This is the Default.sublime-theme one:
{
"class": "sidebar_container",
"layer0.tint": [80, 80, 80],
"layer0.opacity": 1.0,
"layer0.draw_center": false,
"layer0.inner_margin": [0, 0, 1, 0],
"content_margin": [0, 0, 1, 0]
},
while this is the one in the Soda - Dark theme (my personal favorite):
{
"class": "sidebar_container",
"layer0.texture": "Theme - Soda/Soda Dark/sidebar-bg.png",
"layer0.opacity": 1.0,
"layer0.inner_margin": [1, 1, 2, 1],
"content_margin": [0, 0, 1, 0]
},
The key lines we're looking for are "layer0.tint" in Default, and "layer0.texture" in Soda Dark. The Default theme sets the "tint" (or color) of layer0 (the very bottom layer, or background) at [80, 80, 80], which is a list of RGB color values in decimal, with possible values ranging from 0 to 255 (00 to FF in hex), and producing a dark-ish gray. On the other hand, Soda Dark uses "layer0.texture" and a .png file (you can find it and the Retina #2X version in the Soda Dark subdirectory of Theme - Soda) to set the background to a certain color, which happens to be just a bit lighter than [80, 80, 80].
OK, that's all very interesting, but how do I change the background of my sidebar to black? The answer is simple: look in the sidebar_container class, and see if layer0.tint or layer0.texture is being used (hopefully they're not in there together). The easiest way to change the color is to comment out any lines defining layer0.texture by adding // as the first two characters of the line, and either add (if it's not present) or change (if it is present) the layer0.tint line to the following:
"layer0.tint": [0, 0, 0],
then save the file. Now, Sublime is weird about changing themes (and sometimes color schemes). Sometimes I can make a change like this and as soon as I save the file (assuming the theme is already active in my user preferences), Sublime immediately updates all open windows, and I'm happy. Other times, it doesn't seem to do anything immediately, and I have to completely shut down Sublime and restart it to see anything. In either case, though, once you've made this simple change, the background of your sidebar should be nice and black.

Related

Exporting click coordinates Windows or Photoshop

I would like to export click coordinates on an image to a text file, for processing later in another application. Example of format below, will be easy to manipulate once generated of course.
101, 25
200, 31
77, 252
Ideally in Photoshop but actually if I just position the image at 0,0 on my screen, I would be able to use an Windows application to do this, so I think either is fine.
Does anyone know a Photoshop Plugin / Windows application to do this?
I am not certain about specific applications for any location on a screen, however, there are quite a few img map tools available that may be able to help you with an export of the coordinates.
This tool is by far the most versatile that I have found:
"Summer" HTML img Map
Here are a few other tools I have used:
http://www.image-maps.com/
http://www.maschek.hu/imagemap/imgmap
http://www.html-map.com/
...Also, there are a few firefox plugins you can install to help with click areas... you may be able to get the coordinates in a txt file from them:
https://addons.mozilla.org/en-US/firefox/addon/ime/

Ruler not showing up in .md files in Sublime Text 2

I cannot make the ruler appear in .md files. The setting "ruler": [80] is set in every possible place, including in the Default and User settings of the package Markdown Editing. Yet still, the ruler would not appear. I thought this was a color issue, but even after changing the background of the theme to black, the ruler would not appear. In every other file type the ruler appears. What other settings could I check?
Thanks.
The option's name is rulers here (although I am using sublime 3), so "rulers": [80] should work.

Change / Add syntax highlighting for a language in Sublime 2/3

I want to change / add syntax highlighting for a language in Sublime 2/3.
For example I want the keyword this colored in JavaScript.
How can I do that?
I know that there is a preference JavaScript File in C:\Program Files\Sublime Text 3\Packages, but I don't know what to change or if I have to create a new JavaScript Preference File somewhere in this folder %APPDATA%\Sublime Text 3.
Syntax highlighting is controlled by the theme you use, accessible through Preferences -> Color Scheme. Themes highlight different keywords, functions, variables, etc. through the use of scopes, which are defined by a series of regular expressions contained in a .tmLanguage file in a language's directory/package. For example, the JavaScript.tmLanguage file assigns the scopes source.js and variable.language.js to the this keyword. Since Sublime Text 3 is using the .sublime-package zip file format to store all the default settings it's not very straightforward to edit the individual files.
Unfortunately, not all themes contain all scopes, so you'll need to play around with different ones to find one that looks good, and gives you the highlighting you're looking for. There are a number of themes that are included with Sublime Text, and many more are available through Package Control, which I highly recommend installing if you haven't already. Make sure you follow the ST3 directions.
As it so happens, I've developed the Neon Color Scheme, available through Package Control, that you might want to take a look at. My main goal, besides trying to make a broad range of languages look as good as possible, was to identify as many different scopes as I could - many more than are included in the standard themes. While the JavaScript language definition isn't as thorough as Python's, for example, Neon still has a lot more diversity than some of the defaults like Monokai or Solarized.
I should note that I used #int3h's Better JavaScript language definition for this image instead of the one that ships with Sublime. It can be installed via Package Control.
UPDATE
Of late I've discovered another JavaScript replacement language definition - JavaScriptNext - ES6 Syntax. It has more scopes than the base JavaScript or even Better JavaScript. It looks like this on the same code:
Also, since I originally wrote this answer, #skuroda has released PackageResourceViewer via Package Control. It allows you to seamlessly view, edit and/or extract parts of or entire .sublime-package packages. So, if you choose, you can directly edit the color schemes included with Sublime.
ANOTHER UPDATE
With the release of nearly all of the default packages on Github, changes have been coming fast and furiously. The old JS syntax has been completely rewritten to include the best parts of JavaScript Next ES6 Syntax, and now is as fully ES6-compatible as can be. A ton of other changes have been made to cover corner and edge cases, improve consistency, and just overall make it better. The new syntax has been included in the (at this time) latest dev build 3111.
If you'd like to use any of the new syntaxes with the current beta build 3103, simply clone the Github repo someplace and link the JavaScript (or whatever language(s) you want) into your Packages directory - find it on your system by selecting Preferences -> Browse Packages.... Then, simply do a git pull in the original repo directory from time to time to refresh any changes, and you can enjoy the latest and greatest! I should note that the repo uses the new .sublime-syntax format instead of the old .tmLanguage one, so they will not work with ST3 builds prior to 3084, or with ST2 (in both cases, you should have upgraded to the latest beta or dev build anyway).
I'm currently tweaking my Neon Color Scheme to handle all of the new scopes in the new JS syntax, but most should be covered already.
I finally found a way to customize the given Themes.
Go to C:\Program Files\Sublime Text 3\Packages and copy + rename Color Scheme - Default.sublime-package to Color Scheme - Default.zip. Afterwards unzip it and copy the Theme, you want to change to %APPDATA%\Sublime Text 3\Packages\User. (In my case, All Hallow's Eve.tmTheme).
Then you can open it with any Text Editor and change / add something, for example for changing this in JavaScript:
<dict>
<key>name</key>
<string>Lang Variable</string>
<key>scope</key>
<string>variable.language</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#FF0000</string>
</dict>
</dict>
This will mark this in JavaScript Files red. You can select your Theme under Preferences -> Color Scheme -> User -> <Your Name>.
Use the PackageResourceViewer plugin installed via Package Control (as mentioned by MattDMo). This allows you to override the compressed resources by simply opening it in Sublime Text and saving the file. It automatically saves only the edited resources to %APPDATA%/Roaming/Sublime Text 3/Packages/ or ~/.config/sublime-text-3/Packages/.
Specific to the op, once the plugin is installed, execute the PackageResourceViewer: Open Resource command. Then select JavaScript followed by JavaScript.tmLanguage. This will open an xml file in the editor. You can edit any of the language definitions and save the file. This will write an override copy of the JavaScript.tmLanguage file in the user directory.
The same method can be used to edit the language definition of any language in the system.
The "this" is already coloured in Javascript.
View->Syntax-> and choose your language to highlight.
This is my recipe
Note: This isn't exactly what OP is asking. These instructions will help you change the colors of items (comments, keywords, etc) that are defined syntax matching rules. For example, use these instructions to change so that all code comments are colored blue instead of green.
I believe the OP is asking how to define this as an item to be colored when found in a JavaScript source file.
Install Package: PackageResourceViewer
Ctrl+Shift+P > [PackageResourceViewer: Open Resource] > [Color Scheme - Default] > [Marina.sublime-color-scheme] (or whichever color scheme you use)
The above command will open a new tab to the file "Marina.sublime-color-scheme".
For me, this file was located in my roaming profile %appdata% (C:\Users\walter\AppData\Roaming\Sublime Text 3\Packages\Color Scheme - Default\) .
However, if I browse to that path in Windows Explorer, [Color Scheme - Default] is not of a child-dir of [Packages] dir. I suspect that PackageResourceViewer is doing some virtualization.
optional step: On the new color-scheme tab: Ctrl+Shift+P > [Set Syntax: JSON]
Search for the rule you want to change. I wanted to make comments be move visible, so I searched for "Comment"
I found it in the "rules" section
"rules":
[
{
"name": "Comment",
"scope": "comment, punctuation.definition.comment",
"foreground": "var(blue6)"
},
Search for the string "blue6": to find the color variable definitions section. I found it in the "variables" section.
Pick a new color using a tool like http://hslpicker.com/ .
Either define a new color variable, or overwrite the color setting for blue6.
Warning: overwriting blue6 will affect all other text-elements in that color scheme which also use blue6 ("Punctuation" "Accessor").
Save your file, the changes will be applied instantly to any open files/tabs.
NOTES
Sublime will handle any of these color styles. Possibly more.
hsla = hue, saturation, lightness, alpha
rgba = red, green, blue, alpha
hsla(151, 100%, 41%, 1)
- last param is the alpha level (transparency) 1 = opaque, 0.5 = half-transparent, 0 = full-transparent
hsl(151, 100%, 41%) - no alpha channel
rgba(0, 209, 108, 1) - rgb with an alpha channel
rgb(0, 209, 108) - no alpha channel

How do I change the line spacing in Visual Studio 2012?

Is it possible to change the spacing between lines in the Visual Studio 2012 code editing area? After having worked with IntelliJ IDEA for a while, I got accustomed to a slightly larger line spacing (1.2), and I want to achieve the same effect in VS12.
For comparison, the top one is IDEA with 12 pixels spacing between lines, the bottom one is VS12 with 10 pixels spacing:
I find the IDEA version much easier to read, even if it's just 2px difference. Does anyone know?
I've found a workaround which works pretty well, partly alread described in this comment.
You need to download and install TypeLight (free for personal use), and open the Consolas.ttf file inside. To adjust the line spacing, go to Font -> Metrics -> Advanced and change the "Line Gap" to your desire (I changed "Type Line Gap" as well, but I have no idea what this actually does). I experimented a bit with a values and found around 730 to be similar to the 12 pixels spacing in IDEA.
To distinguish the modified font from the regular Consolas, I suggest changing the name of the font under Font -> Names (to "Consolas Spaced" or something). Save the font, double-click the file and choose "Install" from the preview dialog. Then (re)start Visual Studio, choose your modified font and you're done.
As of Visual Studio 2019 (16.10.0) it is now possible to change the line spacing directly in the options under Text Editor => General:
Can't change directly in Visual studio.
--> BUT You CAN change line height of font, the font you're using.
Step 1: install Fontforge.
Step 2: Open Fontforge after install finished, go to:
Element->Font Info ->OS2 -> Unit.
Change 4 value: Down win, up win, top N, down horizontal by multiplied by the desired ratio. Sample: ratio 1.5 or 2 ..etc...
(it means: if default 800, you multiple with ratio 1.5 --> result is 1200, you change 800 -->1200)
--> click OK to save setting.
Step 3: Go to File -> Generate font --> Generate with ttf format.
Step 4: Install the font just created and change font in Visual Studio.

Trouble applying the Soda Theme in Sublime Text 2

I've installed the Soda Theme using the Package Control in Sublime Text 2, then activated it via Preferences -> Settings - User. However it doesn't get applied. Instead my theme now is Solarized, which is declared at the top of my Preferences.sublime-settings file (line 3):
When I query the console for the theme, the output is correct:
>>> view.settings().get('theme')
u'Soda Light.sublime-theme'
This is correct, as well:
>>> view.settings().get('color_scheme')
u'Packages/Color Scheme - Default/Solarized (Light).tmTheme'
Why do I see the Solarized theme and not Soda?
Thanks!
The Theme is not the text-editing screen's colours.
It is the chrome of the program, everything around the text editor; tab styles; etc.
If you check out Soda on Github you can download and then use the same colour scheme as in the screenshots.
In case others are confused by the concept of color_scheme vs theme, this question was answered here.
You have to add , after the first parameters set. It looks like this for me:
{
"theme": "Soda Dark.sublime-theme",
"ignored_packages":
[
"Vintage"
],
"default_encoding": "UTF-8"
}

Resources