Link to home
Start Free TrialLog in
Avatar of jana
janaFlag for United States of America

asked on

Change the size of Windows Terminal and it's background color (Windows 10 Pro)

Hi Experts!

I use Windows Terminal of Windows 10 for command prompt (CMD) and PowerShell.  When opening the windows in my notebook, it pretty large and I want to change it so when clicking on it, it would be in a smaller window size.  Also, change the background color black to half-black or lighter-black.

I have googled on the how-to but it's enormous info.  In one says I have to create a test.json file and instruct me to go to settings within the window, but that opens another file not related to the one I was instructed to create.  So it got confusing for me.

Help.
Avatar of arnold
arnold
Flag of United States of America image

Depending on how you launch... There is an option to set the size/resolution

Alternatively
Mstsc /h:height_pixels /w:width_pixels

H:768 w:1024 . What resolution onthe remote side do you want?
In Windows Terminal, just click on the down arrow and select Settings. That will open the settings.json file which controls all the settings.  If you hold the Alt key while clicking Settings, it will open the defaults.json file, which you can use to look at default settings (more than what is typically present in the settings.json file, and can be useful as a reference), but you won't edit this file.. As far as what to change, the Microsoft documentation is where I would turn, as it's kept up to date with all the changes. Again, in the app, click on the down arrow, then About. That opens a small window with a link to the documentation site.
User generated image
At the site, if you look under Custom Settings > Profile settings > there's a Color settings section which describes how to set the Background color.  You can also look into Color Schemes, of which there are a few default ones included, namely: Campbell, Campbell Powershell, Vintage, One Half Dark, One Half Light, Tango Dark, and Tango Light. Color schemes are also set per profile.
The defaults.json file includes the color codes used in the default schemes, which may be useful as a reference.

In the global settings, you can set "initialCols" and "initialRows" to set how large you want the window.

BTW, I read there's a GUI in preview for version 1.2 for changing all the settings, so that should make things easier in a month or so (assuming it all works out).
Avatar of jana

ASKER

Hi David!

Not really sure in values but want it smaller.  But by knowing where to place the values I can tweak the size wanted.

Where exactly is that line u r saying?

Hi Footech,

Couldn’t find the color setting or the initcol setting (if that’s for resizing the window)
ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jana

ASKER

Thanx Footech, the sizing worked (I placed the 2 lines anywhere and sets its value then restart, worked perfect)

For color, i think I made an error becuase when I try to get in it doesn't.

How can I edit the json file without going into the windows terminal apps?
First open the file as described, then choose Save As and the file save dialog should show you the location of the file.
Avatar of jana

ASKER

I think I did something wrong because after saving the file, now it won't open.

I searched for the location 'C:\Users\jana\AppData\Local\Microsoft\WindowsApps\Microsoft.WindowsTerminal_8wekyb3d8bbwe' but it's empty.

Help get the apps up again please (what am I missing?)
How did you search the location?

If there's no settings.json file there, it gets recreated with defaults when you launch Terminal again.
Avatar of jana

ASKER

Googles it (before I place a question I always google it  - that is what I have been instructed here to do when I started).

But making a second run, found the file:
%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState

please tell me where to change the color to dark-grey or lither-black?
Avatar of jana

ASKER

Hi, found where to place the colors
- Campbell
- Campbell Powershell
- Vintage
- One Half Dark
- One Half Light
- Solarized Dark
- Solarized Light
- Tango Dark
- Tango Light

Place them under:
"defaults":

Open in new window


But havent found to use a certain color in CMD and another to Poweshell

I went to the area where it says "// Make changes here to the powershell.exe profile." but when placing the color doesn't work

help.
Open CMD or PowerShell consoles.

Click top left corner:
User generated image
Click Properties.
User generated image
Make the necessary changes to make things comfortable for your eyes.
Avatar of jana

ASKER

Nope, doesn't work.

Just offers
- color
- rename tab
- close

remember this is Windows Terminal
@Philip - That is for the legacy Windows console, not Windows Terminal.

@jana - Did you read through the color settings section of the documentation site I mentioned?  As I recall, the color scheme, background, and foreground settings are all under the profile settings of the .json file.  Defining the colors of a color scheme is outside the profile settings.  I'm not in front of a computer, so I can't give more info.  

I don't know the color code for the color you want.  There's quite a few color picker websites out there that will give you RGB or HTML color codes for what you pick.
Misread/misinterpreted what you were after, see https://docs.microsoft.com/en-us/windows/terminal/get-started
Look at dynamic profiles then global settings.

See whether the changes you are after are contained there.
https://docs.microsoft.com/en-us/windows/terminal/get-started It is version 1.x
The dimentions of the window that you want is 24x80 lines?
Avatar of jana

ASKER

Thank u guys!  I have the resize and color but still couldn't find color per profile.

I want CMD be one background color and the powershell another color.

How do this or where in the documentation is it?
Avatar of jana

ASKER

Ok, found the areas of the profile under:

"list":

"name": "Command Prompt",

Open in new window


But when I place '"colorScheme": "Color-Name"' it gives error.

So where can I place "colorScheme": "Color-Name"?
You can use the global settings to set the common theme.
https://docs.microsoft.com/en-us/windows/terminal/customize-settings/global-settings#disable-dynamic-profiles

Then use the dynamic profile customization.
Without disabling the dynamic profiles.
Avatar of jana

ASKER

I have the commands to change color, but I have not been able, while going thru the documentation, to know where to place the commands.  

Here is my scenario:

 - My Windows Terminal I can have one window and 2 profiles within that windows: CMD and Powershell.
 - When I placed '"colorScheme": "One Half Dark"' under '"defaults":', both CMD and Powershell is the same color.
 - I want CMD or comman promot to be one color and Powershell be another color.

The above said, where in the settings.json file I place  '"colorScheme": "One Half Dark"' ?
Avatar of jana

ASKER

Better yet, below is my settings.json, please show me where I place these commands that when I open command prompt is one color and powershell is another color:

// Windows Terminal Settings

{
    "$schema": "https://aka.ms/terminal-profiles-schema",

    "defaultProfile": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",

    // Window Size
    "initialCols": 75,
    "initialRows": 20,

    // clipboard like command prompt
    "copyOnSelect": true,
    // clipboard (formatted data copied)
    "copyFormatting": false,

    // Profiles (each one of them will appear in the 'New Tab' dropdown)
    // 
    "profiles":
    {
        "defaults":
        {
            // Put settings here that you want to apply to all profiles.
			"colorScheme": "One Half Dark"
			
        },
        "list":
        
        [
            {
                // Make changes here to the powershell.exe profile.
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name": "Windows PowerShell",                
				"commandline": "powershell.exe",
                "hidden": false
				
            },
            {
                // Make changes here to the cmd.exe profile.
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "name": "Command Prompt",				
                "commandline": "cmd.exe",
                "hidden": false
				
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            }
        ]
    },

    // Add custom color schemes to this array.
    // To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
    "schemes": [],

    // Add custom keybindings to this array.
    // To unbind a key combination from your defaults.json, set the command to "unbound".
    // To learn more about keybindings, visit https://aka.ms/terminal-keybindings
    "keybindings":
    [
        // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
        // These two lines additionally bind them to Ctrl+C and Ctrl+V.
        // To learn more about selection, visit https://aka.ms/terminal-selection
        { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
        { "command": "paste", "keys": "ctrl+v" },

        // Press Ctrl+Shift+F to open the search box
        { "command": "find", "keys": "ctrl+shift+f" },

        // Press Alt+Shift+D to open a new pane.
        // - "split": "auto" makes this pane open in the direction that provides the most surface area.
        // - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
        // To learn more about panes, visit https://aka.ms/terminal-panes
        { "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
    ]
}

Open in new window

You have to define color schemes and then use the colorscheme:scheme name within the section for the respective tool.

 https://docs.microsoft.com/en-us/windows/terminal/customize-settings/color-schemes
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jana

ASKER

Hi Arnold & footech,

I forgot to click submit to my entry (when I closed the question) - just this when I enter the question.  So consider this question closed.

 "profiles":
    {
        "defaults":
        {
            // Put settings here that you want to apply to all profiles.
         
        },
        "list":
        
        [
            {
                // Make changes here to the powershell.exe profile.
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
            "name" : "Windows PowerShell",
            "tabTitle": "PowerShell",
            "commandline" : "powershell.exe",
            "colorScheme" : "Campbell Powershell",
            "fontFace" : "Consolas",
            "fontSize" : 10,
            "hidden" : false

Open in new window