use palette.nu # Generate a Zed theme file from the Nugu semantic palette. def a [color: string alpha: string] { $"($color)($alpha)" } def token [color: string style: any = null weight: any = null] { { color: $color, font_style: $style, font_weight: $weight } } def token-bg [color: string background: string style: any = null weight: any = null] { { color: $color, background_color: $background, font_style: $style, font_weight: $weight } } def theme [mode: string] { let nugu = (palette nugu $mode) let p = $nugu.palette let dark = ($mode == "dark") let bg = $p.content.backdrop let fg = $p.content.normal let panel = $p.ui.backdrop let surface = if $dark { $p.ui.backdrop } else { $p.content.backdrop } let elevated = if $dark { (a $p.ui.minor 2c) } else { $surface } let line = $p.ui.minor let muted = $p.content.minor let ui_muted = $p.ui.minor let accent = $p.ui.accent let selected = $p.ui.focus let ghost = $p.ui.minor let status_alpha = if $dark { "10" } else { "06" } let status_border_alpha = if $dark { "ff" } else { "c0" } let active_line_alpha = if $dark { "cd" } else { "3f" } let selected_alpha = if $dark { "0a" } else { "2b" } let hover = (a $selected $selected_alpha) { name: $"Nugu (($mode | str title-case))" appearance: $mode style: { accents: [$p.ui.accent $p.content.important_local $p.content.focus] "background.appearance": opaque border: $line "border.variant": $p.ui.minor "border.focused": $accent "border.selected": $accent "border.transparent": (a $line 00) "border.disabled": (a $line 60) "elevated_surface.background": $elevated "surface.background": $surface background: $bg "element.background": $panel "element.hover": $hover "element.active": (a $selected $selected_alpha) "element.selected": (a $selected $selected_alpha) "element.disabled": (a $panel 80) "drop_target.background": (a $accent 80) "ghost_element.background": null "ghost_element.hover": (a $ghost 80) "ghost_element.active": $hover "ghost_element.selected": (a $selected $selected_alpha) "ghost_element.disabled": (a $ghost 60) text: $fg "text.muted": $ui_muted "text.placeholder": $ui_muted "text.disabled": $ui_muted "text.accent": $accent icon: $fg "icon.muted": $ui_muted "icon.disabled": $ui_muted "icon.placeholder": $ui_muted "icon.accent": $accent "status_bar.background": $panel "title_bar.background": $panel "title_bar.inactive_background": $panel "toolbar.background": $panel "tab_bar.background": $panel "tab.inactive_background": $panel "tab.active_background": $surface "search.match_background": (a $p.content.focus 80) "panel.background": $panel "panel.focused_border": $accent "pane.focused_border": $accent "pane_group.border": $line "panel.indent_guide": (a $line 60) "panel.indent_guide_active": $p.ui.minor "panel.indent_guide_hover": $accent "scrollbar.thumb.background": $p.ui.minor "scrollbar.thumb.hover_background": $p.ui.minor "scrollbar.thumb.border": $line "scrollbar.track.background": $panel "scrollbar.track.border": (a $line 60) "editor.foreground": $fg "editor.background": $bg "editor.gutter.background": $panel "editor.subheader.background": $surface "editor.indent_guide": (a $line 60) "editor.indent_guide_active": $p.ui.minor "editor.active_line.background": (a $panel $active_line_alpha) "editor.highlighted_line.background": (a $panel 10) "editor.line_number": $ui_muted "editor.active_line_number": $p.ui.important_global "editor.invisible": (a $line 80) "editor.wrap_guide": (a $line 40) "editor.active_wrap_guide": (a $p.ui.minor 80) "editor.document_highlight.bracket_background": (a $p.content.focus 40) "editor.document_highlight.read_background": (a $p.ui.accent 40) "editor.document_highlight.write_background": (a $p.warning 40) "terminal.background": $bg "terminal.ansi.background": $bg "terminal.foreground": $fg "terminal.bright_foreground": $p.ui.important_global "terminal.dim_foreground": $muted "terminal.ansi.black": $muted "terminal.ansi.bright_black": $p.ui.minor "terminal.ansi.dim_black": $muted "terminal.ansi.red": $p.error "terminal.ansi.bright_red": $p.error "terminal.ansi.dim_red": $p.error "terminal.ansi.green": $p.content.focus "terminal.ansi.bright_green": $p.ui.focus "terminal.ansi.dim_green": $p.content.focus "terminal.ansi.yellow": $p.warning "terminal.ansi.bright_yellow": $p.warning "terminal.ansi.dim_yellow": $p.warning "terminal.ansi.blue": $p.content.important_local "terminal.ansi.bright_blue": $p.content.important_global "terminal.ansi.dim_blue": $p.content.important_local "terminal.ansi.magenta": $p.content.accent "terminal.ansi.bright_magenta": $p.ui.accent "terminal.ansi.dim_magenta": $p.content.accent "terminal.ansi.cyan": $p.info "terminal.ansi.bright_cyan": $p.ui.important_local "terminal.ansi.dim_cyan": $p.info "terminal.ansi.white": $fg "terminal.ansi.bright_white": $p.ui.important_global "terminal.ansi.dim_white": $muted "link_text.hover": $accent conflict: $p.error "conflict.background": (a $p.error $status_alpha) "conflict.border": (a $p.error $status_border_alpha) created: $p.content.focus "created.background": (a $p.content.focus $status_alpha) "created.border": (a $p.content.focus $status_border_alpha) deleted: $p.error "deleted.background": (a $p.error $status_alpha) "deleted.border": (a $p.error $status_border_alpha) error: $p.error "error.background": (a $p.error $status_alpha) "error.border": (a $p.error $status_border_alpha) hidden: $line "hidden.background": (a $panel 40) "hidden.border": (a $line 60) hint: $p.info "hint.background": (a $p.info $status_alpha) "hint.border": (a $p.info $status_border_alpha) ignored: (a $muted 60) "ignored.background": (a $panel 40) "ignored.border": (a $line 40) info: $p.info "info.background": (a $p.info $status_alpha) "info.border": (a $p.info $status_border_alpha) modified: $p.ui.important_local "modified.background": (a $p.ui.important_local $status_alpha) "modified.border": (a $p.ui.important_local $status_border_alpha) predictive: (a $muted 80) "predictive.border": $p.ui.minor "predictive.background": (a $p.ui.focus 80) renamed: $p.ui.important_local "renamed.border": (a $p.ui.important_local $status_border_alpha) "renamed.background": (a $p.ui.important_local $status_alpha) success: $p.content.focus "success.background": (a $p.content.focus $status_alpha) "success.border": (a $p.content.focus $status_border_alpha) unreachable: (a $muted 60) "unreachable.background": (a $panel 40) "unreachable.border": (a $line 60) warning: $p.warning "warning.background": (a $p.warning $status_alpha) "warning.border": (a $p.warning $status_border_alpha) players: [ { cursor: $p.ui.accent, background: (a $p.ui.accent 80), selection: (a $p.ui.accent 60) } { cursor: $p.warning, background: (a $p.warning 80), selection: (a $p.warning 60) } ] syntax: { attribute: (token $p.content.minor) boolean: (token $p.content.focus italic) comment: (token $p.content.important_global italic 700) "comment.doc": (token $p.content.important_global italic 700) constant: (token $p.content.focus italic) "constant.builtin": (token $p.content.focus italic) constructor: (token $p.content.important_global null 700) embedded: (token $fg) emphasis: (token $p.content.accent italic) "emphasis.strong": (token $p.content.accent null 700) enum: (token $fg) function: (token $fg) hint: (token $p.ui.important_local) keyword: (token $p.content.minor) label: (token $p.content.minor) link_text: (token $fg) link_uri: (token $p.content.focus italic) number: (token $p.content.focus italic) operator: (token $p.content.minor) preproc: (token $p.content.important_global null 700) primary: (token $fg) property: (token $fg) punctuation: (token $p.content.minor) "punctuation.bracket": (token $p.content.minor) "punctuation.delimiter": (token $p.content.minor) "punctuation.list_marker": (token $p.content.minor) "punctuation.special": (token $p.content.important_global null 700) string: (token $p.content.focus italic) "string.escape": (token $p.content.important_global null 700) "string.regex": (token-bg $p.ui.normal $p.debug null 700) "string.special": (token $p.content.important_global null 700) "string.special.symbol": (token $p.content.important_global null 700) tag: (token $p.content.important_global null 700) "tag.doctype": (token $p.content.important_global null 700) text: (token $fg) "text.literal": (token $p.content.important_global italic 700) title: (token $p.content.important_global null 700) type: (token $fg) "type.builtin": (token $fg) variable: (token $fg) "variable.parameter": (token $p.content.important_local null 700) "variable.special": (token $p.content.important_global null 700) variant: (token $fg) } } } } export def file [] { { "$schema": "https://zed.dev/schema/themes/v0.2.0.json" name: Nugu author: bugabinga themes: [(theme dark) (theme light)] } | to json --indent 2 }