Skip to content

Commit 7bf4491

Browse files
authored
Add catppuccin macchiato theme (#935)
1 parent 149d958 commit 7bf4491

File tree

1 file changed

+152
-0
lines changed

1 file changed

+152
-0
lines changed
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Retrieve the theme settings
2+
export def main [] {
3+
const color_palette = {
4+
rosewater: "#f4dbd6"
5+
flamingo: "#f0c6c6"
6+
pink: "#f5bde6"
7+
mauve: "#c6a0f6"
8+
red: "#ed8796"
9+
maroon: "#ee99a0"
10+
peach: "#f5a97f"
11+
yellow: "#eed49f"
12+
green: "#a6da95"
13+
teal: "#8bd5ca"
14+
sky: "#91d7e3"
15+
sapphire: "#7dc4e4"
16+
blue: "#8aadf4"
17+
lavender: "#b7bdf8"
18+
text: "#cad3f5",
19+
subtext1: "#b8c0e0"
20+
subtext0: "#a5adcb"
21+
overlay2: "#939ab7"
22+
overlay1: "#8087a2"
23+
overlay0: "#6e738d"
24+
surface2: "#5b6078"
25+
surface1: "#494d64"
26+
surface0: "#363a4f"
27+
base: "#24273a"
28+
mantle: "#1e2030"
29+
crust: "#181926"
30+
}
31+
32+
return {
33+
separator: $color_palette.overlay0
34+
leading_trailing_space_bg: { attr: "n" }
35+
header: { fg: $color_palette.blue attr: "b" }
36+
empty: $color_palette.lavender
37+
bool: $color_palette.lavender
38+
int: $color_palette.peach
39+
duration: $color_palette.text
40+
filesize: {|e|
41+
if $e < 1mb {
42+
$color_palette.green
43+
} else if $e < 100mb {
44+
$color_palette.yellow
45+
} else if $e < 500mb {
46+
$color_palette.peach
47+
} else if $e < 800mb {
48+
$color_palette.maroon
49+
} else if $e > 800mb {
50+
$color_palette.red
51+
}
52+
}
53+
date: {|| (date now) - $in |
54+
if $in < 1hr {
55+
$color_palette.green
56+
} else if $in < 1day {
57+
$color_palette.yellow
58+
} else if $in < 3day {
59+
$color_palette.peach
60+
} else if $in < 1wk {
61+
$color_palette.maroon
62+
} else if $in > 1wk {
63+
$color_palette.red
64+
}
65+
}
66+
range: $color_palette.text
67+
float: $color_palette.text
68+
string: $color_palette.text
69+
nothing: $color_palette.text
70+
binary: $color_palette.text
71+
'cell-path': $color_palette.text
72+
row_index: { fg: $color_palette.mauve attr: "b" }
73+
record: $color_palette.text
74+
list: $color_palette.text
75+
block: $color_palette.text
76+
hints: $color_palette.overlay1
77+
search_result: { fg: $color_palette.red bg: $color_palette.text }
78+
79+
shape_and: { fg: $color_palette.pink attr: "b" }
80+
shape_binary: { fg: $color_palette.pink attr: "b" }
81+
shape_block: { fg: $color_palette.blue attr: "b" }
82+
shape_bool: $color_palette.teal
83+
shape_custom: $color_palette.green
84+
shape_datetime: { fg: $color_palette.teal attr: "b" }
85+
shape_directory: $color_palette.teal
86+
shape_external: $color_palette.teal
87+
shape_externalarg: { fg: $color_palette.green attr: "b" }
88+
shape_filepath: $color_palette.teal
89+
shape_flag: { fg: $color_palette.blue attr: "b" }
90+
shape_float: { fg: $color_palette.pink attr: "b" }
91+
shape_garbage: { fg: $color_palette.text bg: $color_palette.red attr: "b" }
92+
shape_globpattern: { fg: $color_palette.teal attr: "b" }
93+
shape_int: { fg: $color_palette.pink attr: "b" }
94+
shape_internalcall: { fg: $color_palette.teal attr: "b" }
95+
shape_list: { fg: $color_palette.teal attr: "b" }
96+
shape_literal: $color_palette.blue
97+
shape_match_pattern: $color_palette.green
98+
shape_matching_brackets: { attr: "u" }
99+
shape_nothing: $color_palette.teal
100+
shape_operator: $color_palette.peach
101+
shape_or: { fg: $color_palette.pink attr: "b" }
102+
shape_pipe: { fg: $color_palette.pink attr: "b" }
103+
shape_range: { fg: $color_palette.peach attr: "b" }
104+
shape_record: { fg: $color_palette.teal attr: "b" }
105+
shape_redirection: { fg: $color_palette.pink attr: "b" }
106+
shape_signature: { fg: $color_palette.green attr: "b" }
107+
shape_string: $color_palette.green
108+
shape_string_interpolation: { fg: $color_palette.teal attr: "b" }
109+
shape_table: { fg: $color_palette.blue attr: "b" }
110+
shape_variable: $color_palette.pink
111+
112+
background: $color_palette.base
113+
foreground: $color_palette.text
114+
cursor: $color_palette.blue
115+
}
116+
}
117+
118+
# Update the Nushell configuration
119+
export def --env "set color_config" [] {
120+
$env.config.color_config = (main)
121+
}
122+
123+
# Update terminal colors
124+
export def "update terminal" [] {
125+
let theme = (main)
126+
127+
# Set terminal colors
128+
let osc_screen_foreground_color = '10;'
129+
let osc_screen_background_color = '11;'
130+
let osc_cursor_color = '12;'
131+
132+
$"
133+
(ansi -o $osc_screen_foreground_color)($theme.foreground)(char bel)
134+
(ansi -o $osc_screen_background_color)($theme.background)(char bel)
135+
(ansi -o $osc_cursor_color)($theme.cursor)(char bel)
136+
"
137+
# Line breaks above are just for source readability
138+
# but create extra whitespace when activating. Collapse
139+
# to one line and print with no-newline
140+
| str replace --all "\n" ''
141+
| print -n $"($in)\r"
142+
}
143+
144+
export module activate {
145+
export-env {
146+
set color_config
147+
update terminal
148+
}
149+
}
150+
151+
# Activate the theme when sourced
152+
use activate

0 commit comments

Comments
 (0)