mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 13:32:50 -05:00
matugen/template: Added neovim to matugen pipeline (#1097)
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -101,6 +101,7 @@ go.work.sum
|
||||
# Editor/IDE
|
||||
# .idea/
|
||||
# .vscode/
|
||||
vim/
|
||||
|
||||
bin/
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ func init() {
|
||||
dank16Cmd.Flags().Bool("json", false, "Output in JSON format")
|
||||
dank16Cmd.Flags().Bool("kitty", false, "Output in Kitty terminal format")
|
||||
dank16Cmd.Flags().Bool("foot", false, "Output in Foot terminal format")
|
||||
dank16Cmd.Flags().Bool("neovim", false, "Output in Neovim plugin format")
|
||||
dank16Cmd.Flags().Bool("alacritty", false, "Output in Alacritty terminal format")
|
||||
dank16Cmd.Flags().Bool("ghostty", false, "Output in Ghostty terminal format")
|
||||
dank16Cmd.Flags().Bool("wezterm", false, "Output in Wezterm terminal format")
|
||||
@@ -40,6 +41,7 @@ func runDank16(cmd *cobra.Command, args []string) {
|
||||
isJson, _ := cmd.Flags().GetBool("json")
|
||||
isKitty, _ := cmd.Flags().GetBool("kitty")
|
||||
isFoot, _ := cmd.Flags().GetBool("foot")
|
||||
isNeovim, _ := cmd.Flags().GetBool("neovim")
|
||||
isAlacritty, _ := cmd.Flags().GetBool("alacritty")
|
||||
isGhostty, _ := cmd.Flags().GetBool("ghostty")
|
||||
isWezterm, _ := cmd.Flags().GetBool("wezterm")
|
||||
@@ -116,6 +118,8 @@ func runDank16(cmd *cobra.Command, args []string) {
|
||||
fmt.Print(dank16.GenerateGhosttyTheme(colors))
|
||||
} else if isWezterm {
|
||||
fmt.Print(dank16.GenerateWeztermTheme(colors))
|
||||
} else if isNeovim {
|
||||
fmt.Print(dank16.GenerateNeovimTheme(colors))
|
||||
} else {
|
||||
fmt.Print(dank16.GenerateGhosttyTheme(colors))
|
||||
}
|
||||
|
||||
@@ -112,3 +112,24 @@ func GenerateWeztermTheme(p Palette) string {
|
||||
p.Color12.Hex, p.Color13.Hex, p.Color14.Hex, p.Color15.Hex)
|
||||
return result.String()
|
||||
}
|
||||
|
||||
func GenerateNeovimTheme(p Palette) string {
|
||||
var result strings.Builder
|
||||
fmt.Fprintf(&result, "vim.g.terminal_color_0 = \"%s\"\n", p.Color0.Hex)
|
||||
fmt.Fprintf(&result, "vim.g.terminal_color_1 = \"%s\"\n", p.Color1.Hex)
|
||||
fmt.Fprintf(&result, "vim.g.terminal_color_2 = \"%s\"\n", p.Color2.Hex)
|
||||
fmt.Fprintf(&result, "vim.g.terminal_color_3 = \"%s\"\n", p.Color3.Hex)
|
||||
fmt.Fprintf(&result, "vim.g.terminal_color_4 = \"%s\"\n", p.Color4.Hex)
|
||||
fmt.Fprintf(&result, "vim.g.terminal_color_5 = \"%s\"\n", p.Color5.Hex)
|
||||
fmt.Fprintf(&result, "vim.g.terminal_color_6 = \"%s\"\n", p.Color6.Hex)
|
||||
fmt.Fprintf(&result, "vim.g.terminal_color_7 = \"%s\"\n", p.Color7.Hex)
|
||||
fmt.Fprintf(&result, "vim.g.terminal_color_8 = \"%s\"\n", p.Color8.Hex)
|
||||
fmt.Fprintf(&result, "vim.g.terminal_color_9 = \"%s\"\n", p.Color9.Hex)
|
||||
fmt.Fprintf(&result, "vim.g.terminal_color_10 = \"%s\"\n", p.Color10.Hex)
|
||||
fmt.Fprintf(&result, "vim.g.terminal_color_11 = \"%s\"\n", p.Color11.Hex)
|
||||
fmt.Fprintf(&result, "vim.g.terminal_color_12 = \"%s\"\n", p.Color12.Hex)
|
||||
fmt.Fprintf(&result, "vim.g.terminal_color_13 = \"%s\"\n", p.Color13.Hex)
|
||||
fmt.Fprintf(&result, "vim.g.terminal_color_14 = \"%s\"\n", p.Color14.Hex)
|
||||
fmt.Fprintf(&result, "vim.g.terminal_color_15 = \"%s\"\n", p.Color15.Hex)
|
||||
return result.String()
|
||||
}
|
||||
|
||||
@@ -274,6 +274,9 @@ output_path = '%s'
|
||||
if !opts.ShouldSkipTemplate("wezterm") {
|
||||
appendTerminalConfig(opts, cfgFile, tmpDir, "wezterm", "wezterm.toml")
|
||||
}
|
||||
if !opts.ShouldSkipTemplate("nvim") {
|
||||
appendTerminalConfig(opts, cfgFile, tmpDir, "nvim", "neovim.toml")
|
||||
}
|
||||
|
||||
if !opts.ShouldSkipTemplate("dgop") {
|
||||
appendConfig(opts, cfgFile, "dgop", "dgop.toml")
|
||||
|
||||
@@ -282,6 +282,7 @@ Singleton {
|
||||
property bool matugenTemplateGhostty: true
|
||||
property bool matugenTemplateKitty: true
|
||||
property bool matugenTemplateFoot: true
|
||||
property bool matugenTemplateNeovim: true
|
||||
property bool matugenTemplateAlacritty: true
|
||||
property bool matugenTemplateWezterm: true
|
||||
property bool matugenTemplateDgop: true
|
||||
|
||||
@@ -829,7 +829,7 @@ Singleton {
|
||||
if (typeof SettingsData !== "undefined") {
|
||||
const skipTemplates = [];
|
||||
if (!SettingsData.runDmsMatugenTemplates) {
|
||||
skipTemplates.push("gtk", "niri", "qt5ct", "qt6ct", "firefox", "pywalfox", "vesktop", "ghostty", "kitty", "foot", "alacritty", "wezterm", "dgop", "kcolorscheme", "vscode");
|
||||
skipTemplates.push("gtk", "neovim", "niri", "qt5ct", "qt6ct", "firefox", "pywalfox", "vesktop", "ghostty", "kitty", "foot", "alacritty", "wezterm", "dgop", "kcolorscheme", "vscode");
|
||||
} else {
|
||||
if (!SettingsData.matugenTemplateGtk)
|
||||
skipTemplates.push("gtk");
|
||||
@@ -851,6 +851,8 @@ Singleton {
|
||||
skipTemplates.push("kitty");
|
||||
if (!SettingsData.matugenTemplateFoot)
|
||||
skipTemplates.push("foot");
|
||||
if (!SettingsData.matugenTemplateNeovim)
|
||||
skipTemplates.push("nvim");
|
||||
if (!SettingsData.matugenTemplateAlacritty)
|
||||
skipTemplates.push("alacritty");
|
||||
if (!SettingsData.matugenTemplateWezterm)
|
||||
|
||||
@@ -182,6 +182,7 @@ var SPEC = {
|
||||
matugenTemplateKitty: { def: true },
|
||||
matugenTemplateFoot: { def: true },
|
||||
matugenTemplateAlacritty: { def: true },
|
||||
matugenTemplateNeovim: { def: true },
|
||||
matugenTemplateWezterm: { def: true },
|
||||
matugenTemplateDgop: { def: true },
|
||||
matugenTemplateKcolorscheme: { def: true },
|
||||
|
||||
@@ -846,6 +846,16 @@ Item {
|
||||
checked: SettingsData.matugenTemplateFoot
|
||||
onToggled: checked => SettingsData.set("matugenTemplateFoot", checked)
|
||||
}
|
||||
SettingsToggleRow {
|
||||
tab: "theme"
|
||||
tags: ["matugen", "neovim", "terminal", "template"]
|
||||
settingKey: "matugenTemplateNeovim"
|
||||
text: "neovim"
|
||||
description: "Requires lazy plugin manager"
|
||||
visible: SettingsData.runDmsMatugenTemplates
|
||||
checked: SettingsData.matugenTemplateNeovim
|
||||
onToggled: checked => SettingsData.set("matugenTemplateNeovim", checked)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
tab: "theme"
|
||||
|
||||
@@ -117,6 +117,7 @@ Templates in `scripts/templates/` generate themes for:
|
||||
- GTK 3/4
|
||||
- Qt5/Qt6
|
||||
- Alacritty, Kitty, Ghostty, Foot, Wezterm terminals
|
||||
- Neovim
|
||||
- VSCode/VSCodium
|
||||
- Firefox
|
||||
|
||||
|
||||
3
quickshell/matugen/configs/neovim.toml
Normal file
3
quickshell/matugen/configs/neovim.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
[templates.dmsneovim]
|
||||
input_path = 'SHELL_DIR/matugen/templates/neovim.lua'
|
||||
output_path = '~/.config/nvim/lua/plugins/dankcolors.lua'
|
||||
51
quickshell/matugen/templates/neovim.lua
Normal file
51
quickshell/matugen/templates/neovim.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
return {
|
||||
{
|
||||
"RRethy/base16-nvim",
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require('base16-colorscheme').setup({
|
||||
base00 = '{{colors.background.default.hex}}',
|
||||
base01 = '{{colors.surface_container.default.hex}}',
|
||||
base02 = '{{colors.surface_container_highest.default.hex}}',
|
||||
base03 = '{{colors.outline_variant.default.hex}}',
|
||||
base04 = '{{colors.on_surface_variant.default.hex}}',
|
||||
base05 = '{{colors.on_surface.default.hex}}',
|
||||
base06 = '{{colors.on_surface.default.hex}}',
|
||||
base07 = '{{colors.inverse_on_surface.default.hex}}',
|
||||
base08 = '{{colors.error.default.hex}}',
|
||||
base09 = '{{colors.tertiary.default.hex}}',
|
||||
base0A = '{{colors.on_surface_variant.default.hex}}',
|
||||
base0B = '{{colors.primary.default.hex}}',
|
||||
base0C = '{{colors.secondary.default.hex}}',
|
||||
base0D = '{{colors.primary.default.hex}}',
|
||||
base0E = '{{colors.secondary.default.hex}}',
|
||||
base0F = '{{colors.error.default.hex}}',
|
||||
})
|
||||
|
||||
local function set_hl_mutliple(groups, value)
|
||||
for _, v in pairs(groups) do vim.api.nvim_set_hl(0, v, value) end
|
||||
end
|
||||
|
||||
vim.api.nvim_set_hl(0, 'Visual',
|
||||
{ bg = '{{colors.primary_container.default.hex}}', fg = '{{colors.on_primary_container.default.hex}}', bold = true })
|
||||
vim.api.nvim_set_hl(0, 'LineNr', { fg = '{{colors.outline_variant.default.hex}}' })
|
||||
vim.api.nvim_set_hl(0, 'CursorLineNr', { fg = '{{colors.primary.default.hex}}', bold = true })
|
||||
|
||||
local current_file_path = vim.fn.stdpath("config") .. "/lua/plugins/dankcolors.lua"
|
||||
|
||||
if not _G._matugen_theme_watcher then
|
||||
local uv = vim.uv or vim.loop
|
||||
_G._matugen_theme_watcher = uv.new_fs_event()
|
||||
|
||||
_G._matugen_theme_watcher:start(current_file_path, {}, vim.schedule_wrap(function()
|
||||
local new_spec = dofile(current_file_path)
|
||||
|
||||
if new_spec and new_spec[1] and new_spec[1].config then
|
||||
new_spec[1].config()
|
||||
print(" Matugen: Colors reloaded!")
|
||||
end
|
||||
end))
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user