Skip to content

Commit

Permalink
add a collection of colorschemes for nushell (nushell#286)
Browse files Browse the repository at this point in the history
* add my personal color config files

remove the useless colors.nu script

* add all lemnos theme files as a submodule

* add a template module from the default dark theme

the `map.csv` file:
```csv
code,bold,bash,nushell
0,false,black,black
1,false,red,red
2,false,green,green
3,false,yellow,yellow
4,false,blue,blue
5,false,magenta,purple
6,false,cyan,cyan
7,false,white,light_gray
8,true,black,dark_gray
9,true,red,red_bold
10,true,green,green_bold
11,true,yellow,yellow_bold
12,true,blue,blue_bold
13,true,magenta,purple_bold
14,true,cyan,light_cyan
14,true,cyan,cyan_bold
15,true,white,white
```

the command used was
```nushell
open map.csv |
each {
    |it|
    sed -i $"s/: ($it.nushell)$/: \"{{color($it.code)}}\"/" template.nu
}
```
or as a oneliner
```nushell
open map.csv | each {|it| sed -i $"s/: ($it.nushell)$/: \"{{color($it.code)}}\"/" template.nu}
```

* add a script to make all the scripts at once

* make all the themes

* add a README with some credits to lemnos

* add usage instructions to the README

* add desired values to the template

This commit adds the background, the foreground and the cursor
colors to the themes as commented lines.
These do not fit into any nushell theme as they should be set by the
terminal emulator, but they are included here for completeness.

Addresses nushell#286 (comment)

* regenerate the themes with the new template

* remove all the occurences of sed by str replace

* remove the lemnos submodule

Co-authored-by: amtoine <[email protected]>
  • Loading branch information
amtoine and amtoine committed Sep 7, 2022
1 parent d160647 commit bdfed70
Show file tree
Hide file tree
Showing 452 changed files with 27,509 additions and 0 deletions.
18 changes: 18 additions & 0 deletions themes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Nushell themes

Credit to @lemnos and [all contributors](https://github.com/lemnos/theme.sh/blob/master/CREDITS.md).

## Use a colorscheme
Currently, the theme change has to be a bit manual.
To have access to the list of all the themes,
```rust
ls ./themes/themes
```

To use the `dracula` theme for instance, please run
```rust
use ./themes/themes/dracula.nu *
let-env config = ($env.config | merge {{color_config: (dracula)}})
```

The theme should be activated!
41 changes: 41 additions & 0 deletions themes/make.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env nu

let RAW = "lemnos/themes"
let THEMES = "themes"


def make-theme [theme: string] {
let colors = (
open $"($RAW)/($theme)" |
lines |
split column " " |
rename name rgb
)
let theme_file = $"($THEMES)/($theme).nu"

cp template.nu $theme_file

$colors |
each {
|it|
open $theme_file --raw |
str replace $"{{($it.name)}}" $it.rgb --all |
save $theme_file
}

open $theme_file --raw |
str replace "{{theme}}" ($theme | str replace '-' '_') --all |
save $theme_file
}


mkdir $THEMES

ls $RAW |
get name |
str replace $"($RAW)/" "" |
each {
|it|
print $it
make-theme $it
}
61 changes: 61 additions & 0 deletions themes/template.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
export def {{theme}} [] {
# extra desired values for the {{theme}} theme
# which do not fit into any nushell theme
# these colors should be handledd by the terminal
# emulator itself
#
# background: "{{background}}"
# foreground: "{{foreground}}"
# cursor: "{{cursor}}"

{
# color for nushell primitives
separator: "{{color15}}"
leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off
header: "{{color10}}"
empty: "{{color4}}"
bool: "{{color15}}"
int: "{{color15}}"
filesize: "{{color15}}"
duration: "{{color15}}"
date: "{{color15}}"
range: "{{color15}}"
float: "{{color15}}"
string: "{{color15}}"
nothing: "{{color15}}"
binary: "{{color15}}"
cellpath: "{{color15}}"
row_index: "{{color10}}"
record: "{{color15}}"
list: "{{color15}}"
block: "{{color15}}"
hints: "{{color8}}"

# shapes are used to change the cli syntax highlighting
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
shape_binary: "{{color13}}"
shape_bool: "{{color14}}"
shape_int: "{{color13}}"
shape_float: "{{color13}}"
shape_range: "{{color11}}"
shape_internalcall: "{{color14}}"
shape_external: "{{color6}}"
shape_externalarg: "{{color10}}"
shape_literal: "{{color4}}"
shape_operator: "{{color3}}"
shape_signature: "{{color10}}"
shape_string: "{{color2}}"
shape_string_interpolation: "{{color14}}"
shape_datetime: "{{color14}}"
shape_list: "{{color14}}"
shape_table: "{{color12}}"
shape_record: "{{color14}}"
shape_block: "{{color12}}"
shape_filepath: "{{color6}}"
shape_globpattern: "{{color14}}"
shape_variable: "{{color5}}"
shape_flag: "{{color12}}"
shape_custom: "{{color2}}"
shape_nothing: "{{color14}}"
}
}
61 changes: 61 additions & 0 deletions themes/themes/3024-day.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
export def 3024_day [] {
# extra desired values for the 3024_day theme
# which do not fit into any nushell theme
# these colors should be handledd by the terminal
# emulator itself
#
# background: "#f7f7f7"
# foreground: "#4a4543"
# cursor: "#4a4543"

{
# color for nushell primitives
separator: "#f7f7f7"
leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off
header: "#3a3432"
empty: "#01a0e4"
bool: "#f7f7f7"
int: "#f7f7f7"
filesize: "#f7f7f7"
duration: "#f7f7f7"
date: "#f7f7f7"
range: "#f7f7f7"
float: "#f7f7f7"
string: "#f7f7f7"
nothing: "#f7f7f7"
binary: "#f7f7f7"
cellpath: "#f7f7f7"
row_index: "#3a3432"
record: "#f7f7f7"
list: "#f7f7f7"
block: "#f7f7f7"
hints: "#5c5855"

# shapes are used to change the cli syntax highlighting
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
shape_binary: "#d6d5d4"
shape_bool: "#cdab53"
shape_int: "#d6d5d4"
shape_float: "#d6d5d4"
shape_range: "#4a4543"
shape_internalcall: "#cdab53"
shape_external: "#b5e4f4"
shape_externalarg: "#3a3432"
shape_literal: "#01a0e4"
shape_operator: "#fded02"
shape_signature: "#3a3432"
shape_string: "#01a252"
shape_string_interpolation: "#cdab53"
shape_datetime: "#cdab53"
shape_list: "#cdab53"
shape_table: "#807d7c"
shape_record: "#cdab53"
shape_block: "#807d7c"
shape_filepath: "#b5e4f4"
shape_globpattern: "#cdab53"
shape_variable: "#a16a94"
shape_flag: "#807d7c"
shape_custom: "#01a252"
shape_nothing: "#cdab53"
}
}
61 changes: 61 additions & 0 deletions themes/themes/3024-night.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
export def 3024_night [] {
# extra desired values for the 3024_night theme
# which do not fit into any nushell theme
# these colors should be handledd by the terminal
# emulator itself
#
# background: "#090300"
# foreground: "#a5a2a2"
# cursor: "#a5a2a2"

{
# color for nushell primitives
separator: "#f7f7f7"
leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off
header: "#3a3432"
empty: "#01a0e4"
bool: "#f7f7f7"
int: "#f7f7f7"
filesize: "#f7f7f7"
duration: "#f7f7f7"
date: "#f7f7f7"
range: "#f7f7f7"
float: "#f7f7f7"
string: "#f7f7f7"
nothing: "#f7f7f7"
binary: "#f7f7f7"
cellpath: "#f7f7f7"
row_index: "#3a3432"
record: "#f7f7f7"
list: "#f7f7f7"
block: "#f7f7f7"
hints: "#5c5855"

# shapes are used to change the cli syntax highlighting
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
shape_binary: "#d6d5d4"
shape_bool: "#cdab53"
shape_int: "#d6d5d4"
shape_float: "#d6d5d4"
shape_range: "#4a4543"
shape_internalcall: "#cdab53"
shape_external: "#b5e4f4"
shape_externalarg: "#3a3432"
shape_literal: "#01a0e4"
shape_operator: "#fded02"
shape_signature: "#3a3432"
shape_string: "#01a252"
shape_string_interpolation: "#cdab53"
shape_datetime: "#cdab53"
shape_list: "#cdab53"
shape_table: "#807d7c"
shape_record: "#cdab53"
shape_block: "#807d7c"
shape_filepath: "#b5e4f4"
shape_globpattern: "#cdab53"
shape_variable: "#a16a94"
shape_flag: "#807d7c"
shape_custom: "#01a252"
shape_nothing: "#cdab53"
}
}
61 changes: 61 additions & 0 deletions themes/themes/3024.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
export def 3024 [] {
# extra desired values for the 3024 theme
# which do not fit into any nushell theme
# these colors should be handledd by the terminal
# emulator itself
#
# background: "#090300"
# foreground: "#a5a2a2"
# cursor: "#a5a2a2"

{
# color for nushell primitives
separator: "#f7f7f7"
leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off
header: "#01a252"
empty: "#01a0e4"
bool: "#f7f7f7"
int: "#f7f7f7"
filesize: "#f7f7f7"
duration: "#f7f7f7"
date: "#f7f7f7"
range: "#f7f7f7"
float: "#f7f7f7"
string: "#f7f7f7"
nothing: "#f7f7f7"
binary: "#f7f7f7"
cellpath: "#f7f7f7"
row_index: "#01a252"
record: "#f7f7f7"
list: "#f7f7f7"
block: "#f7f7f7"
hints: "#5c5855"

# shapes are used to change the cli syntax highlighting
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
shape_binary: "#a16a94"
shape_bool: "#b5e4f4"
shape_int: "#a16a94"
shape_float: "#a16a94"
shape_range: "#fded02"
shape_internalcall: "#b5e4f4"
shape_external: "#b5e4f4"
shape_externalarg: "#01a252"
shape_literal: "#01a0e4"
shape_operator: "#fded02"
shape_signature: "#01a252"
shape_string: "#01a252"
shape_string_interpolation: "#b5e4f4"
shape_datetime: "#b5e4f4"
shape_list: "#b5e4f4"
shape_table: "#01a0e4"
shape_record: "#b5e4f4"
shape_block: "#01a0e4"
shape_filepath: "#b5e4f4"
shape_globpattern: "#b5e4f4"
shape_variable: "#a16a94"
shape_flag: "#01a0e4"
shape_custom: "#01a252"
shape_nothing: "#b5e4f4"
}
}
61 changes: 61 additions & 0 deletions themes/themes/abyss.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
export def abyss [] {
# extra desired values for the abyss theme
# which do not fit into any nushell theme
# these colors should be handledd by the terminal
# emulator itself
#
# background: "#040f18"
# foreground: "#c0c7ca"
# cursor: "#10598b"

{
# color for nushell primitives
separator: "#a0cce2"
leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off
header: "#10598b"
empty: "#277bb1"
bool: "#a0cce2"
int: "#a0cce2"
filesize: "#a0cce2"
duration: "#a0cce2"
date: "#a0cce2"
range: "#a0cce2"
float: "#a0cce2"
string: "#a0cce2"
nothing: "#a0cce2"
binary: "#a0cce2"
cellpath: "#a0cce2"
row_index: "#10598b"
record: "#a0cce2"
list: "#a0cce2"
block: "#a0cce2"
hints: "#708e9e"

# shapes are used to change the cli syntax highlighting
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
shape_binary: "#4595bd"
shape_bool: "#2592d3"
shape_int: "#4595bd"
shape_float: "#4595bd"
shape_range: "#1f6ca1"
shape_internalcall: "#2592d3"
shape_external: "#2592d3"
shape_externalarg: "#10598b"
shape_literal: "#277bb1"
shape_operator: "#1f6ca1"
shape_signature: "#10598b"
shape_string: "#10598b"
shape_string_interpolation: "#2592d3"
shape_datetime: "#2592d3"
shape_list: "#2592d3"
shape_table: "#277bb1"
shape_record: "#2592d3"
shape_block: "#277bb1"
shape_filepath: "#2592d3"
shape_globpattern: "#2592d3"
shape_variable: "#4595bd"
shape_flag: "#277bb1"
shape_custom: "#10598b"
shape_nothing: "#2592d3"
}
}
Loading

0 comments on commit bdfed70

Please sign in to comment.