How to add theme in Visual Studio Code? - color-scheme

I recently downloaded the VS code editor which is really nice.
but the only problem I find in it is the color theme, I am use to
monokai color theme like in sublime text and I can't find a way to edit
the color theme or download a color theme there are only 2 options:
Dark Theme
Light Theme
How can I add my own theme or duplicate existing one so I will be able to
edit the color scheme as I want to?
I manage to change some of the colors in the following file but still
I don`t know how to add completely new theme:
resources/app/client/vs/monaco/ui/workbench/native/native.main.css
Looks like color themes will be available soon and it will be a part of a plugin system
visual-studio-code/suggestions/7756227-theme

Visual Studio Code 0.9.0 and later
There's an official documentation on how to add a custom theme.
You need a .tmtheme file for the theme you want to add. You can find existing files e.g. on GitHub, ColorSublime or you can define your own theme file (for example with tmTheme-Editor).
After finding a .tmtheme file you have two ways to create an extension based on it.
Using a Yeoman generator:
Install node.js (if you haven't already done)
Install yo (if you haven't already done) by executing npm install -g yo
Install the Yo generator for code: npm install -g generator-code
Run yo code and select New Color Theme
Follow the instructions (define the .tmTheme file, theme name, ui theme etc.)
The generator creates a directory for your extension with the name of the theme in your current working directory.
Create the directory on your own:
Create a directory with the name of your plugin (only lowercase letters). Let's say we call it mytheme.
Add a subfolder themes and place the .tmTheme file inside of it
Create a file package.json inside the root of the extension folder with content like this
{
"name": "theme-mytheme",
"version": "0.0.1",
"engines": {
"vscode": ">=0.9.0-pre.1"
},
"publisher": "me",
"contributes": {
"themes": [
{
"label": "My Theme",
"uiTheme": "vs-dark", // use "vs" to select the light UI theme
"path": "./themes/mytheme.tmTheme"
}
]
}
}
Finally add your extension to Visual Studio Code
Copy the extension folder to the extension directory. This is:
on Windows %USERPROFILE%\.vscode\extensions
on Mac/Linux $HOME/.vscode/extensions
Restart VSCode and select the new theme in File -> Preferences -> Color Theme
Visual Studio Code 0.8.0
It's possible to add new themes in Visual Studio Code 0.8.0 (released for insiders on 2015-08-31 become an insider).
After installing VSCode 0.8.0 or higher do this to apply your own theme:
Download a .tmTheme file or create your own (for example with tmTheme-Editor)
Copy the .tmTheme file to %CODEFOLDER%/resources/app/plugins/vs.theme.starterkit/themes
Register the .tmTheme file in %CODEFOLDER%/resources/app/plugins/vs.theme.starterkit/ticino.plugin.json by adding an entry for it like this:
{
"id": "vs-theme-mynewtheme", // internal ID
"label": "MyNewTheme", // displayed name for the theme
"uiTheme": "vs-dark", // general UI appeareance (
// "vs" for light themes,
// "vs-dark" for dark themes)
"path": "./themes/myNewTheme.tmTheme" // file path
},
Restart VSCode and select the new theme in File -> Preferences -> Color Theme

Adding a completely new theme is not currently supported.
You can submit your feature requests here, I already heard people asking for this https://visualstudio.uservoice.com/forums/293070-visual-studio-code

I found that the file - resources/app/client/vs/monaco/ui/workbench/native/native.main.css - is also the right place for changing how fonts are renderer. I was trying to figure out how to disable font smoothing on OS X and found that you can do it here by adding this CSS rule in the file -
.monaco-editor {
-webkit-font-smoothing: none;
}

Related

Gatsby: Apply new theme to starter

I'm new to Gatsby and I started a project using a starter, Gatsby-starter-ghost. The starter comes with the Casper theme, and now I want to replace Casper with a new theme or build a custom theme.
I can't figure out how to replace Casper or even find where it is in the project folders. There is a lot of documentation available on Gatsby themes and starters but I can barely find any documentation for gatsby-starter-ghost. I've dug through the node_modules and src folders and can't even find where the Casper theme is located. If I install a new theme with npm and put the plugin in the gatsby-config file it breaks my project and I get GraphQL errors galore. I've read that themes should usually be in the content folder, but my content folder contains nothing but two empty folders.
Here is my project structure:
How do I replace the theme in the gatsby-ghost-starter?
Gatsby Themes use a concept called 'shadowing'. You can replace any of the default files for the theme by placing a file with the same path and name in your content folder. This is probably why your folder doesn't have any theme files, the starter is just using all the defaults.
That said, looking at gatsby-starter-ghost, it doesn't look like it's using a Gatsby Theme at all, so shadowing doesn't apply.
If you look at gatsby-starter-ghost/src/components/common/, it has various files which define the components that are being used. Most notably, Layout.js is setting out the base structure for every page, and imports a CSS file from ../../styles/app.css.
This CSS, those common components, as well as the various template files in src/templates are what is defining the HTML structure of the pages, and the CSS that those use. If you adjust those, you should be able to change the design to suit your needs.
Start by looking at app.css and adjusting it a bit, see how far that takes you. But you may need to update the components if you want to introduce new classes or change the HTML structure.

Change language to JSX in Visual Studio Code

Visual Studio Code now supports JSX on 0.8 version, but looks like the only way to activate it is with a .jsx file extension. It is not on the list to change the language mode manually, the nearest option is JavaScriptReact, but it doesn't parse the JSX tags.
I'm in a project with a lot of .js files with JSX and I can't change it.
Is there any other way to use JSX syntax without the .jsx extension?
Change your user settings or workspace settings as below:
// Place your settings in this file to overwrite the default settings
{
"files.associations": {
"*.js": "javascriptreact"
}
}
Note: You might need to restart VSCode.
I would feel the below is the easiest way of formatting the code
Click on the bottom right on VS Code Editor where it says Javascript.
You will see an option to Select the language Mode, here you can search for JavaScriptReact and select. That's it. This should solve your problem.
1.
I could do it, but "not React JS files" are also show with JavaScriptReact mode.
open file C:\Program Files (x86)\Microsoft VS Code\resources\app\plugins\vs.language.javascript\syntaxes\javascriptreact.json
(probably, need to open with administrator privileges.)
change "jsx" to "js" in array "fileTypes".
restart app, close opened js files, and reopen.
Took me a while to figure this out but – JSX is already part of Emmet – which is part of VS Code. I've told Emmet to also (additionally) make JSX snippets available in regular JS files.
Just put this in your settings file:
"emmet.syntaxProfiles": {
"javascript": "jsx"
}
Although Dionys' answer works there is a better way to do this in more recent versions of Visual Studio Code.
Go to File>Prefrences>Settings and then scroll down and find "Emmet" open the tab and you should see the following text
// Enable Emmet abbreviations in languages that are not supported by default. Add a
mapping here between the language and emmet supported language.
// E.g.: {"vue-html": "html", "javascript": "javascriptreact"}
"emmet.includeLanguages": {},
So just follow the instructions and add "emmet.includeLanguages": { "javascript": "javascriptreact" } on the json at the right panel ( which will overwrite the user settings ).
There is now a VS Code extension that allows .js files to be treated as .jsx files.
Unfortunately the readme for the extension also warns:
when you install this extension you will loose all the existing language support provided for .js files
Fortunately VS Code is now very close to adopting Salsa, which means soon the js-is-jsx issue should be completely resolved.
1-Press F1 (in Visual Studio Code)
2-Type "extension" in the appearing text field
3-Pick "Extensions: Install Extension"
3-Type "ext install jsx"
4- install JS JSX Snippets
5-Restart Visual Studio Code
Click on the bottom right on VS Code Editor where it says Javascript. You will see an option to Select the language Mode, here you can search for JavaScriptReact and select.
That's it.
Just install an extension:
Press F1 (in Visual Studio Code)
Type "extension" in the appearing text field
Pick "Extensions: Install Extension"
Type "ext install jsx"
Restart Visual Studio Code
Source:
https://code.visualstudio.com/docs/editor/extension-gallery?pub=TwentyChung&ext=jsx
https://marketplace.visualstudio.com/items/TwentyChung.jsx
Try using link on Mac or Linux.
ln -s index.ios.js index.ios.jsx

What exactly I should do to make 'angular' resolved in .ts file in WebStorm

I wonder.. what exactly I should do to make WebStrom (or IntelliJ IDEA) resolve my 'angular' variable.
I follows this guy but that maybe deprecated already.
On my vendor.d.ts:
/// <reference path="../typings/jquery/jquery.d.ts" />
/// <reference path="../typings/angularjs/angular.d.ts" />
My package json:
{
"name": "angular_ts",
"version": "0.1.0",
"description": "",
"repository": {},
"dependencies": {
"grunt": "~0.4.5",
"grunt-ts": "~3.0.0"
}
}
My issue on that screenshot ('angular' is not resolved.. can not go to definition of it, as a result - multiple implementations of 'module'):
So, what exactly I should do to make 'angular' resolved in .ts file in WebStorm?
UPDATE:
I do not have yet angularjs sources in my project. But one of the options where it redirects me is "node_modules/grunt-ts/tasks/inerfaces.d.ts" file. Even if I exclude 'node_modules' folder from my project.
You have to do a few things to get this to work correctly. I don't know what that tutorial told you to do, but it's not the WebStorm usual way of doing it.
Firstly, you need to make WebStorm ignore all the AngularJS source files in your project. This is why you're getting the multiple implementations warning.
Open your "project" side panel that displays the file tree.
Find where you put your angular.min.js source files, and right click the file.
Select "Mark as Plain Text". WebStorm will now ignore that file from intellisense for JavaScript.
You have to now add AngularJS to your list of External Libraries for that project.
Click "File / Settings"
Expand the "Languages & Frameworks" node
Expand the "JavaScript" node
Select the "Libraries" section.
This is where you install third-party TS files for libraries. Select the "angularjs-DefinitelyTyped" library, but this doesn't come with WebStorm. You have to download and install it.
Click the "Download..." button.
Change the dropdown on the dialog from "Official libraries" to "TypeScrypt community stubs".
Find "angularjs", select it and click "Download and Install".
That's basically what I do. The key is to exclude the JS files in your project that will interfere with intellisense.
When you install external libraries to a WebStorm project via the settings. It doesn't actually add those files to the project. They are only added to the intellisense space used by the IDE.
Ok.
Since I did not have yet angularjs sources (yet) in my project.
And one of the options where it redirects me is "node_modules/grunt-ts/tasks/inerfaces.d.ts" file. Even if I exclude 'node_modules' folder from my project.
My solution is to remove node_modules from the Project Structure -> Libraries there was reference to 'node_modules' (also)..
But it is basically the same principle as Mathew suggested.
(Hope that will not break another stuff in the project)

ExtJS custom theme: Generating darker icons for panel.

In my project there is a requirement to create custom theme. The base color of the components is very light(almost white). The issue is the icons appearing on the header of panels/windows(close, maximize) are almost invisible. What are the sass variables I need to declare so that the images used for these panels and windows are darker(in contrast to white)? And in which scss file do I need to include them?
You will need to replace those images, in ExtJS 5 you can find them at:
YourProjectFolder/ext/packages/your-theme/resources/images/tools/
There you will have two files, tools-sprites.png and tool-sprites-dark.png
You can replace them there if you are using the standard theme or you can save the new image in your custom theme folder path.
Notice that for this to work properly with all browsers, you will have to rebuild your theme using sencha command.

Drupal 7 Bamboo theme maintenance mode

I am trying to make a custom maintenance page for Bamboo theme in Drupal 7.
I already follow some tips I have found in internet, but they don't work.
The site is in maintenance mode, but with a layout totally different from the rest of the theme (it is a simple logo with the message "site in maintenance ..."
In the theme there isn't a template named maintenance-page.tpl.php in root theme directory neither in subdirectory templates.
I created a new file copied from html.tpl.php in both directory, but without success.
Some advice? What should I do?
Thanks in advance,Mauro
You can copy the maintenance-page.tpl.php from Bartik (default
Drupal theme) and paste it to you theme folder
Customize the new file maintenance-page.tpl.php

Resources