1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-07-31 14:17:45 +00:00
nu_scripts/themes/README.md
NotTheDr01ds 8557653047
Recover non-lemnos themes (#902)
Changes:

* Custom Nushell `color_config`'s (non-Lemnos) are moved to the
`./src/custom-nu-themes` directory and used to generate the main theme
files when doing a `./make.nu`
* `make.nu` and other scripts (e.g. preview) have been moved to the
`src` directory
* A separate `README` for the `src` scripts
* Main theme `README` updated for clarity
* Reordered the theme template, so all themes were regenerated. I'd like
to stop doing this ;-)

@amtoine Thanks for your suggestions on the `README`. I've pretty
extensively changed the flow, so please re-review and let me know how it
looks. Also note that I haven't personally tested with Nupm, so please
especially review this section. Thanks!

@fdncred CC

Still planning on working on the preview scripts next. They'll need only
slight changes to run (probably a path change), but they can be
simplified a bit now, I hope. At the same time, I'll complicate them in
other ways ;-).

Note that there is a bug in both `nushell-dark` and `nushell-light` that
prevented the terminal colors from being updated regardless. You can see
that in the existing screenshots, where both those themes simply re-use
the previous theme (alphabetically's) background. I haven't fixed this
yet.
2024-07-19 13:27:05 -05:00

118 lines
3.3 KiB
Markdown

# Nushell Themes
Credit to @lemnos and [all contributors](https://github.com/lemnos/theme.sh/blob/master/CREDITS.md).
Note:
* If using Nupm, or the `<package_root>/themes` directory of this package/repository is in your `$env.NU_LIB_DIRS`, then most of the commands below can be run from anywhere on your system.
* Otherwise, all examples assume they are run from the `<package_root>/themes` directory.
## Basic usage
### Activate a colorscheme
```nu
source nu-themes/<theme>.nu
```
For example, to use the `dracula` theme:
```nu
source nu-themes/dracula.nu
```
The theme should be activated!
Note that these settings are for the current shell only.
### Making changes permanent
Add the command above to your `config.nu` file as shown in [the Configuration chapter of The Book](https://www.nushell.sh/book/configuration.html).
Note that, if not using Nupm or a `NU_LIB_DIR` path, you should use the fully qualified path to the themes directory on your system. For example:
```nu
source ~/nu_scripts/themes/nu-themes/dracula.nu
```
### List all themes
Currently, this is done by simply manually listing the contents of the `nu-themes` directory:
```nu
ls <package_root>/themes/nu-themes
```
## Advanced
Themes are composed of two parts:
* A Nushell `color_config` record which is used to set `$env.config.color_config`
* A command to update your terminal's foreground, background, and cursor colors. While this assumes that your terminal supports the appropriate OSC codes, the codes need are very basic and should be supported by most any terminal.
You may wish to set the Nushell `color_config` without changing your terminal's colors, or vice-versa. These themes provide additional commands that allow you to accomplish this.
**Important:** Notice that while the "Basic usage" above uses `source` to activate the theme, the following examples *import* the theme module with a `use` statement.
### Load a color_config
For example, to load and use the `tokyo-night` theme's colors without changing the terminal settings:
#### Display a theme's `color_config` settings
```nu
> use nu-themes/tokyo-night.nu
> tokyo-night
```
#### Activate a Nushell `color_config`
```nu
> use nu-themes/tokyo-night.nu
> tokyo-night set color_config
```
or
```nu
> use nu-themes/tokyo-night.nu
> $env.config.color_config = (tokyo-night)
```
### Set terminal colors
Or you can change the terminal settings to use the theme's foreground/background/cursor colors without changing the Nushell `color_config`.
Again, using the `tokyo-night` theme as an example:
```nushell
> use nu-themes/tokyo-night.nu
> tokyo-night update terminal
```
## Using Nupm
The parent `nu_scripts` package can be installed and updated using [Nupm].
1. Install [Nupm] by following the [Nupm instructions]
2. Download the `nu_scripts` repository
```shell
git clone https://github.com/nushell/nu_scripts
```
3. Activate the `nupm` module with `use nupm`
4. Install the `nu-scripts` package
```nushell
nupm install --path --force nu_scripts
```
> **Note**
> installing the `nu-scripts` package will install `nu-themes` and other modules
## Screenshots
Here are [screenshots](./screenshots/README.md) of our themes.
[Nupm]: https://github.com/nushell/nupm
[Nupm instructions]: https://github.com/nushell/nupm#recycle-installation-toc