Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export def main [] {
} else if $in > 1wk {
$color_palette.red
}
}
}
range: $color_palette.text
float: $color_palette.text
string: $color_palette.text
Expand Down Expand Up @@ -112,4 +112,40 @@ export def main [] {
foreground: $color_palette.text
cursor: $color_palette.blue
}
}
}

# Update the Nushell configuration
export def --env "set color_config" [] {
$env.config.color_config = (main)
}

# Update terminal colors
export def "update terminal" [] {
let theme = (main)

# Set terminal colors
let osc_screen_foreground_color = '10;'
let osc_screen_background_color = '11;'
let osc_cursor_color = '12;'

$"
(ansi -o $osc_screen_foreground_color)($theme.foreground)(char bel)
(ansi -o $osc_screen_background_color)($theme.background)(char bel)
(ansi -o $osc_cursor_color)($theme.cursor)(char bel)
"
# Line breaks above are just for source readability
# but create extra whitespace when activating. Collapse
# to one line and print with no-newline
| str replace --all "\n" ''
| print -n $"($in)\r"
}

export module activate {
export-env {
set color_config
update terminal
}
}

# Activate the theme when sourced
use activate
7 changes: 3 additions & 4 deletions themes/nu-themes/catppuccin-latte.nu
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Retrieve the theme settings
export def main [] {
const color_palette = {
rosewater: "#dc8a78"
Expand Down Expand Up @@ -50,7 +49,7 @@ export def main [] {
$color_palette.red
}
}
datetime: {|| (date now) - $in |
date: {|| (date now) - $in |
if $in < 1hr {
$color_palette.green
} else if $in < 1day {
Expand Down Expand Up @@ -115,7 +114,7 @@ export def main [] {
}
}

# Update the Nushell configuration
# Update the Nushell configuration
export def --env "set color_config" [] {
$env.config.color_config = (main)
}
Expand Down Expand Up @@ -149,4 +148,4 @@ export module activate {
}

# Activate the theme when sourced
use activate
use activate
7 changes: 3 additions & 4 deletions themes/nu-themes/catppuccin-mocha.nu
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Retrieve the theme settings
export def main [] {
const color_palette = {
rosewater: "#f5e0dc"
Expand Down Expand Up @@ -50,7 +49,7 @@ export def main [] {
$color_palette.red
}
}
datetime: {|| (date now) - $in |
date: {|| (date now) - $in |
if $in < 1hr {
$color_palette.green
} else if $in < 1day {
Expand Down Expand Up @@ -115,7 +114,7 @@ export def main [] {
}
}

# Update the Nushell configuration
# Update the Nushell configuration
export def --env "set color_config" [] {
$env.config.color_config = (main)
}
Expand Down Expand Up @@ -149,4 +148,4 @@ export module activate {
}

# Activate the theme when sourced
use activate
use activate
8 changes: 8 additions & 0 deletions themes/src/asciinema-script
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use .. *
sleep 200ms
source ../nu-themes/$theme_name.nu
clear
print 'Theme: ($theme_name)'
print -n (preview theme small)
sleep 200ms
print ""
115 changes: 0 additions & 115 deletions themes/src/custom-nu-themes/catppuccin-latte.nu

This file was deleted.

115 changes: 0 additions & 115 deletions themes/src/custom-nu-themes/catppuccin-mocha.nu

This file was deleted.

7 changes: 7 additions & 0 deletions themes/src/minicap-script
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use .. *
source ($theme_name)
clear
sleep 100ms
print `Theme name: '($theme_name)'
print -n (preview theme small | table -e)
sleep 250ms
15 changes: 15 additions & 0 deletions themes/src/powershell-script
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use .. *
source ($theme_name)
clear
sleep 100ms
print `Theme name: '($theme_name)'`
print -n \(preview theme small | table -e)
sleep 250ms

$Host.UI.RawUI.WindowTitle = 'Theme Preview'
Add-Type -AssemblyName System.Windows.Forms
[Windows.Forms.Sendkeys]::SendWait\('%{Prtsc}')
[Windows.Forms.Sendkeys]::SendWait\('%{Prtsc}')
[Windows.Forms.Sendkeys]::SendWait\('%{Prtsc}')
sleep 1
[Windows.Forms.Clipboard]::GetImage\().Save\('($theme_name).png', [System.Drawing.Imaging.ImageFormat]::Png)
Loading
Loading