ホームページ  >  記事  >  システムチュートリアル  >  Windowsターミナルは味気ないのでカッコよくしてみました

Windowsターミナルは味気ないのでカッコよくしてみました

WBOY
WBOYオリジナル
2024-07-17 16:05:45447ブラウズ

Windows 터미널의 오래된 "검은 화면에 흰색 텍스트" 모양이 마음에 들지 않습니까? 나도 마찬가지다. 다행스럽게도 계속 고수할 필요는 없습니다. 터미널과 관련된 여러 항목을 변경하는 방법과 터미널의 모양과 느낌을 완전히 바꾸는 방법은 다음과 같습니다.

내장된 사용자 정의 옵션은 훌륭한 시작입니다

Windows 터미널에는 즉각적인 외관 업그레이드를 수행하기 위해 조정할 수 있는 다양한 내장 설정이 포함되어 있습니다. Microsoft Store에서 Windows 터미널 앱을 설치했는지 확인하세요.

The Windows Terminal Looks Dull, so I Made It Look Cool

작업 표시줄의 검색으로 이동하여 터미널을 입력한 다음 상단 결과를 엽니다.

The Windows Terminal Looks Dull, so I Made It Look Cool

제목 표시줄에서 드롭다운 버튼을 누르고 '설정'으로 이동하세요.

The Windows Terminal Looks Dull, so I Made It Look Cool

이제부터 다양한 설정을 조정하여 Windows 터미널의 모양과 느낌을 변경하겠습니다.

제목 표시줄

제목 표시줄부터 시작해 보겠습니다. 지금은 단색 검정색이지만 투명하게 만들 수 있습니다. "모양"으로 이동하여 "탭 행에 아크릴 소재 사용"을 켠 다음 "저장"을 클릭하여 변경 사항을 적용합니다.

The Windows Terminal Looks Dull, so I Made It Look Cool

제목 표시줄이 흐릿한 효과로 투명해져야 합니다. 터미널 창 뒤에 있지만 흐릿한 유리 뒤에 있는 것이 무엇이든 볼 수 있습니다.

The Windows Terminal Looks Dull, so I Made It Look Cool

테마 변경

"모양" 메뉴의 "응용 프로그램 테마" 드롭다운 메뉴에서 밝은 테마와 어두운 테마를 선택할 수 있습니다.

The Windows Terminal Looks Dull, so I Made It Look Cool

"색 구성표" 메뉴에는 더 많은 테마가 포함되어 있으며 자신만의 색 구성표를 만들 수도 있습니다.

The Windows Terminal Looks Dull, so I Made It Look Cool

새로운 색 구성표를 추가할 때 두 가지 옵션이 있습니다.

"새로 추가" 버튼을 누르고 색상 선택을 시도해 본 후 "저장" 버튼을 눌러 새 색상 구성표로 저장할 수 있습니다. 그런 다음 색 구성표 목록에서 해당 구성표를 선택할 수 있습니다. 사용을 시작하려면 기본값으로 설정해야 합니다.

The Windows Terminal Looks Dull, so I Made It Look Cool The Windows Terminal Looks Dull, so I Made It Look Cool The Windows Terminal Looks Dull, so I Made It Look Cool

다른 옵션은 JSON 코드를 사용하여 색 구성표를 정의하고 이를 터미널의 JSON 파일에 추가하는 것입니다.

먼저 색 구성표에 대한 JSON 코드를 생성해야 합니다. 그러나 인터넷에서 맞춤 제작된 테마를 많이 찾을 수 있습니다. Windows Terminal Themes 및 TerminalSplash와 같은 많은 웹사이트에서는 다양한 테마에 대한 JSON 코드를 제공합니다. 자신의 취향에 맞는 것을 검색하고 선택하세요. 시연을 위해 저는 TerminalSplash에서 Solarized Dark Patched 테마를 선택했습니다.

JSON 코드를 복사한 후 터미널의 JSON 파일을 엽니다.

The Windows Terminal Looks Dull, so I Made It Look Cool

JSON 파일용 기본 텍스트 편집기(아마도 메모장)에서 열립니다. 그런 다음 구성표 섹션을 찾을 때까지 아래로 스크롤하십시오. 검색 기능을 이용하면 더 빠르게 찾을 수도 있습니다.

The Windows Terminal Looks Dull, so I Made It Look Cool

구성표 섹션을 찾은 후 마지막 구성표에 도달할 때까지 조금 더 아래로 스크롤하세요(각 구성표는 중괄호로 닫힌 다음 쉼표로 구분됩니다.) 마지막 구성표 뒤에 쉼표를 추가한 다음 해당 색상의 JSON 코드를 붙여넣으세요. 계획.

The Windows Terminal Looks Dull, so I Made It Look Cool

Save the file and exit the JSON file. Go back to the "Color Schemes" menu, and you should see the newly added theme in the list. Set it as default to use it. Press the "Save" button to save your changes. To see the new theme in action, restart the Windows Terminal.

The Windows Terminal Looks Dull, so I Made It Look Cool

Fonts

To change the fonts you use in the Terminal, go to "Defaults" under Profiles. Then, under Additional Settings, go to "Appearance."

The Windows Terminal Looks Dull, so I Made It Look Cool

You should see a few font-related options here. You can choose the font family, font size, and font weight.

The Windows Terminal Looks Dull, so I Made It Look Cool

There are a few fonts to choose from. If you fancy, you can download additional fonts from Nerd Fonts, install them, and configure them so you can use them system-wide, including the Terminal.

Color and Background

When you choose a theme, it automatically selects a set of colors. However, you can adjust the colors individually. The settings let you pick colors using RGB values, HSV values, color codes, and a graphical color picker. You can set a color for the foreground, background, cursor, and selection.

The Windows Terminal Looks Dull, so I Made It Look Cool

If you don't like using solid colors for the Terminal background, you can also choose images. Go to Defaults > Appearance, then under Background Image, provide a path for the image you'd like to use as the background. You can also use your desktop wallpaper. Once you choose an image, you'll notice more options, such as the image stretch mode, alignment, and opacity.

The Windows Terminal Looks Dull, so I Made It Look Cool

Make sure to choose a less bright image as your background. Otherwise, you'll have a hard time seeing the text. Another option is to lower the opacity to about 50%.

The Windows Terminal Looks Dull, so I Made It Look Cool

Using Oh My Posh to Beautify the Windows Terminal

Oh My Posh is a custom prompt theme engine for shells, including CMD and PowerShell. It allows you to set colorful and meaningful themes on the Terminal prompt.

Installing and Setting Up Oh My Posh

To install Oh My Posh, you'll first need the winget package manager installed. After that, run this command in CMD to install Oh My Posh:

winget install JanDeDobbeleer.OhMyPosh -s winget
The Windows Terminal Looks Dull, so I Made It Look Cool

After the installation, restart the Terminal to reload the PATH. To confirm the installation, run:

oh-my-posh
The Windows Terminal Looks Dull, so I Made It Look Cool

Great! It's been installed successfully. Now we can customize our Terminal using this tool.

Customizing the Terminal

To make the most out of Oh My Posh, you should install a Nerd Font. That's because Oh My Posh uses many icons and glyphs not supported by the default installed fonts on your system. If you didn't install a font in the previous step, you can do so now using Oh My Posh. Open the Terminal as an administrator. Then view the available fonts by running this command:

oh-my-posh font install

You can scroll and choose a font to install it. I'm going to install "Meslo."

The Windows Terminal Looks Dull, so I Made It Look Cool

Alternatively, you can install the font by adding its name to the previous command, like this:

oh-my-posh font install meslo

After that, set it as default in the settings.json file by adding the font name in the font face section under profiles. Save the file.

The Windows Terminal Looks Dull, so I Made It Look Cool

Now let's try an Oh My Posh theme. Open PowerShell and run:

oh-my-posh init pwsh --config "$env:POSH_THEMES_PATHjandedobbeleer.omp.json" | Invoke-Expression
The Windows Terminal Looks Dull, so I Made It Look Cool

That already looks better than what we had.

If you're having rendering problems, or seeing unsupported characters in your theme, in the Terminal, go to Settings > Rendering. Turn on "Use the new text renderer ("AtlasEngine")." Also, make sure you've installed a compatible Nerd Font.

However, if you restart the Terminal, it will be gone. So, let's make it the default shell theme for PowerShell. Open your PowerShell profile in a text editor. To open it in Notepad, run:

notepad $PROFILE

In case you don't already have one, you'll get a prompt to create one. Press "Yes." Then enter the following line in the file:

oh-my-posh init pwsh | Invoke-Expression
The Windows Terminal Looks Dull, so I Made It Look Cool

Save the file and reload the profile with this command:

. $PROFILE

Using the above command may show an error about running scripts. In that case, run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine as administrator first.

Now, whenever you open PowerShell, you'll see the Oh My Posh custom prompt.

The Windows Terminal Looks Dull, so I Made It Look Cool

There are dozens of themes in Oh My Posh. To get a glance of all of them, run this in PowerShell:

Get-PoshThemes
The Windows Terminal Looks Dull, so I Made It Look Cool

I really like the "atomic" theme, so I'll switch to that. To switch the theme, I'll run:

oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/atomic.omp.json" | Invoke-Expression
The Windows Terminal Looks Dull, so I Made It Look Cool

If you want to switch to another theme, just replace "atomic" with your theme name in the above script.

If you see an error about Get-PSReadLineKeyHandler, run Install-Module PsReadLine -Force as administrator first.

Once again, to make the change stay permanently, open the PowerShell profile file, remove the line you wrote previously and add the above line.

The Windows Terminal Looks Dull, so I Made It Look Cool

Then reload your profile with this command:

. $PROFILE

You can adjust existing themes by color, segments, and icons. First, you'll need to export the theme as a JSON, YAML, or TOML file. Then you can edit that file to make changes and store it as a custom theme. You can even create your own themes in the same way.

A little icing on the cake would be using custom icons in addition to custom fonts in the Terminal. Terminal-Icons, a PowerShell module, lets you add cool icons for folders, scripts, and other types of files. First, install the module with this command as administrator:

Install-Module -Name Terminal-Icons -Repository PSGallery

Then open your PowerShell profile with the command below:

notepad $PROFILE

Add the following line to the file:

Import-Module -Name Terminal-Icons

Save the file and relaunch PowerShell. Lastly, check out the icons by running ls in PowerShell.

The Windows Terminal Looks Dull, so I Made It Look Cool

Combining everything so far, here's my final result.

The Windows Terminal Looks Dull, so I Made It Look Cool

A Beautiful Windows Terminal at Your Service

By now, you should have a cool looking Terminal on your Windows computer. With some creativity, you can make it more flashy. If you'd like to read more on what you can do with Oh My Posh, check the official documentation.

以上がWindowsターミナルは味気ないのでカッコよくしてみましたの詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。