Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Commit

Permalink
add theme example to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
SneakySensei authored and JanDeDobbeleer committed Oct 2, 2020
1 parent 234668d commit fab0e29
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
51 changes: 28 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

## Table of Contents

* [About](#about)
* [Prerequisites](#prerequisites)
* [Installation](#installation)
* [Configuration](#configuration)
* [Helper functions](#helper-functions)
* [Themes](#themes)
- [About](#about)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Configuration](#configuration)
- [Helper functions](#helper-functions)
- [Themes](#themes)

## About

Expand All @@ -31,16 +31,16 @@ More information about why I made this can be found on my [blog].

Features:

* Easy installation
* Awesome prompt themes for PowerShell in ConEmu
* Git status indications (powered by posh-git)
* Failed command indication
* Admin indication
* Current session indications (admin, failed command, user)
* Configurable
* Easily create your own theme
* Separate settings for oh-my-posh and posh-git
* Does not mess with the default Powershell console
- Easy installation
- Awesome prompt themes for PowerShell in ConEmu
- Git status indications (powered by posh-git)
- Failed command indication
- Admin indication
- Current session indications (admin, failed command, user)
- Configurable
- Easily create your own theme
- Separate settings for oh-my-posh and posh-git
- Does not mess with the default Powershell console

## Prerequisites

Expand Down Expand Up @@ -127,9 +127,9 @@ $ThemeSettings
You can tweak the settings by manipulating `$ThemeSettings`.
This example allows you to tweak the branch symbol using a unicode character:

````powershell
```powershell
$ThemeSettings.GitSymbols.BranchSymbol = [char]::ConvertFromUtf32(0xE0A0)
````
```

Also do not forget the Posh-Git settings itself (enable the stash indication for example):

Expand All @@ -145,7 +145,7 @@ $DefaultUser = 'yourUsernameHere'

## Helper functions

`Set-Theme`: set a theme from the Themes directory. If no match is found, it will not be changed. Autocomplete is available to list and complete available themes.
`Set-Theme`: set a theme from the Themes directory. If no match is found, it will not be changed. Autocomplete is available to list and complete available themes.

```powershell
Set-Theme paradox
Expand Down Expand Up @@ -218,13 +218,17 @@ Set-Theme paradox

![Emodipt Theme][img-theme-emodipt]

### Operator

![Operator Theme][img-theme-operator]

## Creating your own theme

If you want to create a theme it can be done rather easily by adding a `mytheme.psm1` file in the folder indicated in `$ThemeSettings.MyThemesLocation` (the folder defaults to `~\Documents\WindowsPowerShell\PoshThemes`, feel free to change it).

The only required function is `Write-Theme`. You can use the following template to get started:

````powershell
```powershell
#requires -Version 2 -Modules posh-git
function Write-Theme
Expand All @@ -240,7 +244,7 @@ function Write-Theme
}
$sl = $global:ThemeSettings #local settings
````
```

Feel free to use the public helper functions `Get-VCSStatus`, `Get-VcsInfo`, `Get-FormattedRootLocation`, `Get-ShortPath`, `Set-CursorForRightBlockWrite`, `Set-CursorUp`, `Set-Newline` or add your own logic completely.

Expand Down Expand Up @@ -282,8 +286,8 @@ if($env:LC_TERMINAL -eq "iTerm2") {

### Based on work by

* [Chris Benti][chrisbenti-psconfig]
* [Keith Dahlby][keithdahlby-poshgit]
- [Chris Benti][chrisbenti-psconfig]
- [Keith Dahlby][keithdahlby-poshgit]

[build-status-badge]: https://img.shields.io/appveyor/ci/janjoris/oh-my-posh/master.svg?maxAge=2592000
[build-status]: https://ci.appveyor.com/project/JanJoris/oh-my-posh
Expand Down Expand Up @@ -336,4 +340,5 @@ if($env:LC_TERMINAL -eq "iTerm2") {
[img-theme-star]: img/star.png
[img-theme-zash]: img/zash.png
[img-theme-emodipt]: img/emodipt.png
[img-theme-operator]: img/operator.png
[consoletitle]: https://github.com/JanDeDobbeleer/oh-my-posh/issues/261#issuecomment-649701607
Binary file added img/operator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fab0e29

Please sign in to comment.