new file: config/Kvantum/matugen/matugen.kvconfig new file: config/Kvantum/matugen/matugen.svg modified: config/btop/btop.conf new file: config/btop/themes/matugen.theme modified: config/cava/config new file: config/cava/themes/matugen modified: config/clipse/config.json new file: config/clipse/matugen.json modified: config/fish/config.fish modified: config/fish/fish_variables new file: config/fish/functions/bx.fish deleted: config/fish/functions/fish_prompt.fish new file: config/fish/functions/ntodo.fish new file: config/fish/functions/o.fish modified: config/foot/foot.ini new file: config/foot/themes/input-matugen-theme.ini new file: config/foot/themes/input-matugen-theme.ini.bak new file: config/foot/themes/matugen-theme.ini new file: config/foot/themes/matugen-theme.ini.bak modified: config/foot/themes/theme.ini new file: config/foot/themes/theme.ini.bak new file: config/gtk-2.0/gtkfilechooser.ini new file: config/gtk-3.0/bookmarks new file: config/gtk-3.0/colors.css new file: config/gtk-3.0/colors.css.bak new file: config/gtk-3.0/colors.css.nak new file: config/gtk-3.0/gtk.css new file: config/gtk-3.0/gtk.css.backup new file: config/gtk-3.0/gtk.css.backup.1776208757 new file: config/gtk-3.0/settings.ini new file: config/gtk-4.0/assets new file: config/gtk-4.0/colors.css new file: config/gtk-4.0/colors.css.bak new file: config/gtk-4.0/gtk-dark.css new file: config/gtk-4.0/gtk.css new file: config/gtk-4.0/gtk.css.backup renamed: config/niri/dms/windowrules.kdl -> config/gtk-4.0/libadwaita-tweaks.css new file: config/gtk-4.0/libadwaita.css new file: config/gtk-4.0/settings.ini new file: config/hypr/colors-hyprlock.conf new file: config/hypr/colors.conf modified: config/hypr/hyprlock.conf modified: config/hypr/hyprlock.conf.bak modified: config/hypr/hyprtoolkit.conf modified: config/hyprwave/config.conf modified: config/hyprwhspr/config.json modified: config/hyprwhspr/mic_osd.pid new file: config/ironbar/colors.css modified: config/ironbar/config.json deleted: config/ironbar/schema-v0.18.0.json new file: config/ironbar/scripts/clipse.sh new file: config/ironbar/scripts/matugen.sh new file: config/ironbar/scripts/matugen.sh.bak modified: config/ironbar/scripts/pomo new file: config/ironbar/scripts/volume.sh modified: config/ironbar/style.css new file: config/ironbar/style.css.bak modified: config/kitty/current-theme.conf deleted: config/kitty/current-theme1.conf deleted: config/kitty/dank-tabs.conf modified: config/kitty/kitty.conf modified: config/kitty/kitty.conf.bak new file: config/kitty/themes/Matugen.conf modified: config/matugen/config.toml deleted: config/matugen/custom3.json new file: config/matugen/scripts/foot-apply-colors.sh new file: config/matugen/scripts/foot-apply-colors.sh.bak new file: config/matugen/scripts/foot-apply.sh new file: config/matugen/scripts/hyprwave-reload.sh new file: config/matugen/scripts/ironbar-toggle.sh new file: config/matugen/scripts/matugen-foot-apply.sh new file: config/matugen/scripts/swayosd-reload.sh new file: config/matugen/scripts/walker.sh new file: config/matugen/templates/Matugen.colors new file: config/matugen/templates/alacritty.toml new file: config/matugen/templates/btop.theme new file: config/matugen/templates/cava-colors.ini new file: config/matugen/templates/clipse_theme.json new file: config/matugen/templates/colors.css new file: config/matugen/templates/cosmic_postprocess.py new file: config/matugen/templates/cosmic_theme.ron new file: config/matugen/templates/dunstrc-colors new file: config/matugen/templates/firefox-colors.css new file: config/matugen/templates/foot-apply-colors.sh new file: config/matugen/templates/foot.ini new file: config/matugen/templates/fuzzel.ini new file: config/matugen/templates/ghostty new file: config/matugen/templates/gtk-colors.css new file: config/matugen/templates/helix.toml new file: config/matugen/templates/heroic.css new file: config/matugen/templates/hyprland-colors.conf new file: config/matugen/templates/hyprlock.conf new file: config/matugen/templates/hyprtoolkit.conf new file: config/matugen/templates/hyprwave.css new file: config/matugen/templates/hypwave.css new file: config/matugen/templates/ironbar.css new file: config/matugen/templates/kitty-colors.conf new file: config/matugen/templates/kvantum-colors.kvconfig new file: config/matugen/templates/kvantum-colors.svg new file: config/matugen/templates/labwc new file: config/matugen/templates/mako new file: config/matugen/templates/mango.conf new file: config/matugen/templates/matugen.obt new file: config/matugen/templates/mcfly.toml new file: config/matugen/templates/micro.micro new file: config/matugen/templates/midnight-discord.css new file: config/matugen/templates/neovim.lua new file: config/matugen/templates/neovim/README.md new file: config/matugen/templates/neovim/init.lua new file: config/matugen/templates/neovim/template.lua new file: config/matugen/templates/niri-colors.kdl new file: config/matugen/templates/nvim-colors.vim new file: config/matugen/templates/obsidian.css new file: config/matugen/templates/opencode-colors.json new file: config/matugen/templates/prismlauncher.json new file: config/matugen/templates/pywalfox-colors.json new file: config/matugen/templates/qtct-colors.conf new file: config/matugen/templates/quickshell.json new file: config/matugen/templates/quickshell.qml new file: config/matugen/templates/rmpc/nix-hm-example/README.md new file: config/matugen/templates/rmpc/nix-hm-example/matugen/default.nix new file: config/matugen/templates/rmpc/nix-hm-example/matugen/templates/cava.ini new file: config/matugen/templates/rmpc/nix-hm-example/matugen/templates/rmpc.ron new file: config/matugen/templates/rmpc/rmpc.ron new file: config/matugen/templates/rofi-colors.rasi new file: config/matugen/templates/spicetify.ini new file: config/matugen/templates/starship-colors.toml new file: config/matugen/templates/steam.css new file: config/matugen/templates/sway-colors.conf new file: config/matugen/templates/swaync-colors.css new file: config/matugen/templates/swayosd.css new file: config/matugen/templates/telegram-background-solid.svg new file: config/matugen/templates/telegram.tdesktop-theme new file: config/matugen/templates/telegram.tdesktop-theme.bak new file: config/matugen/templates/television.toml new file: config/matugen/templates/terminal-sequences new file: config/matugen/templates/tmux-colors.conf new file: config/matugen/templates/vivaldi.css new file: config/matugen/templates/walker.css new file: config/matugen/templates/wezterm_theme.toml new file: config/matugen/templates/windows_term.json new file: config/matugen/templates/windows_term_post.ps1 new file: config/matugen/templates/wine.reg new file: config/matugen/templates/yazi-theme.toml new file: config/matugen/templates/zathura-colors new file: config/matugen/templates/zed-colors.json new file: config/matugen/templates/zellij-theme.kdl.tera new file: config/matugen/templates/zen-userChrome.css new file: config/matugen/templates/zen-userContent.css new file: config/matugen/templates/zen.css modified: config/mimeapps.list modified: config/niri/binds.kdl new file: config/niri/clipse.sh new file: config/niri/colors.kdl modified: config/niri/config.kdl deleted: config/niri/dms/alttab.kdl deleted: config/niri/dms/binds.kdl deleted: config/niri/dms/colors.kdl deleted: config/niri/dms/cursor.kdl deleted: config/niri/dms/layout.kdl deleted: config/niri/dms/outputs.kdl deleted: config/niri/dms/profiles/profile_1776211496314_g03e3q.kdl deleted: config/niri/dms/wpblur.kdl modified: config/niri/layer-rule.kdl modified: config/niri/layout.kdl new file: config/niri/scripts/ocr.sh modified: config/niri/spawn-at-startup.kdl modified: config/niri/window-rule.kdl new file: config/nvim/colors/matugen.vim modified: config/nvim/init.lua modified: config/nvim/lazy-lock.json new file: config/nvim/lua/matugen.lua new file: config/nvim/lua/plugins/base16-nvim.lua renamed: config/nvim/lua/plugins/render-markdown.lua -> config/nvim/lua/plugins/render-markdown.lua.bak new file: config/nvim/lua/plugins/themery.lua new file: config/nvim/lua/plugins/zk-nvim.lua new file: config/rmpc/themes/matugen.ron new file: config/rudo/all-style.css new file: config/rudo/pins.json new file: config/rudo/settings.json new file: config/rudo/style.css new file: config/scripts/niri/ru.png new file: config/scripts/niri/us.png modified: config/starship.toml new file: config/stasis/stasis.rune new file: config/swaync/colors.css deleted: config/swaync/config_1.json modified: config/swaync/style.css deleted: config/swaync/style_1.css new file: config/swayosd/colors.css modified: config/swayosd/style.css new file: config/telegram/matugen.tdesktop-theme new file: config/telegram/matugen/background.jpg new file: config/telegram/matugen/background.svg new file: config/telegram/matugen/colors.tdesktop-theme deleted: config/termusic/tui.toml new file: config/tmux/colors.conf modified: config/tmux/tmux.conf modified: config/walker/config.toml modified: config/walker/themes/default/layout.xml new file: config/walker/themes/matugen/colors.css new file: config/walker/themes/matugen/item.xml new file: config/walker/themes/matugen/item_actionsmenu.xml new file: config/walker/themes/matugen/item_archlinuxpkgs.xml new file: config/walker/themes/matugen/item_bookmarks.xml new file: config/walker/themes/matugen/item_calc.xml new file: config/walker/themes/matugen/item_clipboard.xml new file: config/walker/themes/matugen/item_dmenu.xml new file: config/walker/themes/matugen/item_dnfpackages.xml new file: config/walker/themes/matugen/item_files.xml new file: config/walker/themes/matugen/item_providerlist.xml new file: config/walker/themes/matugen/item_symbols.xml new file: config/walker/themes/matugen/item_symbols_grid.xml new file: config/walker/themes/matugen/item_todo.xml new file: config/walker/themes/matugen/item_unicode.xml new file: config/walker/themes/matugen/keybind.xml new file: config/walker/themes/matugen/layout.xml new file: config/walker/themes/matugen/preview.xml new file: config/walker/themes/matugen/style.css modified: config/walker/themes/zzz/layout.xml modified: config/walker/themes/zzz/style.css deleted: config/waybar/config.jsonc deleted: config/waybar/config01.jsonc deleted: config/waybar/style.css deleted: config/waybar/style01.css new file: config/yazi/theme.toml modified: config/zathura/zathurarc deleted: config/zram-generator.conf modified: copy.sh modified: local/share/hyprwave/style.css
153 lines
5.7 KiB
Markdown
153 lines
5.7 KiB
Markdown
# Matugen + Neovim
|
|
|
|
> [!NOTE]
|
|
> This theme is primarily a proof-of-concept with sample colors chosen. While
|
|
> it is usable and somewhat complete, the colors themselves may not necessarily
|
|
> look the best, so it's important you style them accordingly if you are
|
|
> unsatisfied with the result. Additionally, this setup only styles basic
|
|
> Neovim colors + Lualine. Other plugins that manage their own highlight groups
|
|
> are not covered by this guide (e.g. Neogit)
|
|
|
|
|
|
## The `base16-colorscheme` Plugin
|
|
|
|
As with any program broad and free as Neovim, there are infinite ways to go
|
|
about styling it. However, the easiest approach is to utilize
|
|
the `base16-colorscheme` plugin. This plugin allows you to pass in an arbitrary
|
|
list of 16 color values, and it will automatically propagate them to all
|
|
highlight groups in a reasonable fashion.
|
|
|
|
```lua
|
|
-- THIS IS NOT THE ENTIRE TEMPLATE FILE
|
|
-- To see why, continue reading below...
|
|
require('base16-colorscheme').setup({
|
|
base00 = "{{colors.background.default.hex}}",
|
|
base01 = "{{colors.surface_container_lowest.default.hex}}",
|
|
base02 = "{{colors.surface_container_low.default.hex}}",
|
|
base03 = "{{colors.outline_variant.default.hex}}",
|
|
base04 = "{{colors.on_surface_variant.default.hex}}",
|
|
base05 = "{{colors.on_surface.default.hex}}",
|
|
base06 = "{{colors.inverse_on_surface.default.hex}}",
|
|
base07 = "{{colors.surface_bright.default.hex}}",
|
|
base08 = "{{colors.tertiary.default.hex | lighten: -5}}",
|
|
base09 = "{{colors.tertiary.default.hex}}",
|
|
base0A = "{{colors.secondary.default.hex}}",
|
|
base0B = "{{colors.primary.default.hex}}",
|
|
base0C = "{{colors.tertiary_container.default.hex}}",
|
|
base0D = "{{colors.primary_container.default.hex}}",
|
|
base0E = "{{colors.secondary_container.default.hex}}",
|
|
base0F = "{{colors.secondary.default.hex | lighten: -10}}",
|
|
})
|
|
```
|
|
|
|
While this `.setup()` call takes care of mostly everything, some additional
|
|
calls to `nvim_set_hl` may be needed to tweak colors to your liking:
|
|
|
|
``` lua
|
|
-- Make selected text stand out more
|
|
vim.api.nvim_set_hl(0, 'Visual', {
|
|
bg = '{{colors.primary_container.default.hex}}',
|
|
fg = '{{colors.background.default.hex}}',
|
|
})
|
|
```
|
|
|
|
## Lualine (and plugins that manage their own colors)
|
|
|
|
Because Lualine has its own specific named highlight groups, the
|
|
`base16-colorscheme` plugin cannot style it within its `setup` function.
|
|
Thankfully, Lualine is flexible enough to offer the following configuration
|
|
option, which aids the process a little:
|
|
|
|
```lua
|
|
require('lualine').setup({
|
|
options = {
|
|
theme = "base16",
|
|
}
|
|
})
|
|
```
|
|
|
|
Setting this option tells Lualine to base its highlight group colors off of
|
|
some internal 16 base values (which `base16-colorscheme` sets). While this helps,
|
|
it unfortunately does not give us full hot-reloading out of the box. In addition
|
|
to this, Lualine must be **re-sourced upon every matugen update** in order to
|
|
refresh its colors.
|
|
|
|
If you are using an unmodified (or simple) Lualine configuration, all you need
|
|
to do add a `require('lualine').setup({})` to the end of matugen's
|
|
`template.lua`, which will re-setup Lualine as the output file gets sourced.
|
|
However, if your Lualine setup is a bit complex, it can be sub-optimal to copy
|
|
its entire setup function into the matugen template file.
|
|
|
|
One solution to this is to refactor your Lualine setup into its own file, and
|
|
then just call `dofile()` on said file from both your `init.lua` and matugen
|
|
template. _(This is not necessary, but helps tidy your configuration up)_
|
|
|
|
## Init Hook
|
|
|
|
It's a good idea to attempt to source matugen's generated file upon Neovim's
|
|
startup, falling back to a default colorscheme when the matugen file is
|
|
unavailable. The following code snippet can be added in your `init.lua` or
|
|
adjacent to safely perform this source:
|
|
|
|
```lua
|
|
local function source_matugen()
|
|
-- Update this with the location of your output file
|
|
local matugen_path = os.getenv("HOME") .. "/.config/nvim/generated.lua" -- dofile doesn't expand $HOME or ~
|
|
|
|
local file, err = io.open(matugen_path, "r")
|
|
-- If the matugen file does not exist (yet or at all), we must initialize a color scheme ourselves
|
|
if err ~= nil then
|
|
-- Some placeholder theme, this will be overwritten once matugen kicks in
|
|
vim.cmd('colorscheme base16-catppuccin-mocha')
|
|
|
|
-- Optionally print something to the user
|
|
vim.print("A matugen style file was not found, but that's okay! The colorscheme will dynamically change if matugen runs!")
|
|
else
|
|
dofile(matugen_path)
|
|
io.close(file)
|
|
end
|
|
end
|
|
```
|
|
|
|
## Updating Neovim with New Colors
|
|
|
|
Neovim does not support hot-reloading directly, so we must register an
|
|
`autocmd` to listen process signals and execute Lua code as a result. This is
|
|
fairly simply, as shown below:
|
|
|
|
> [!NOTE] The below `autocmd` is only tested for Linux. Separate workarounds
|
|
> may be required for other systems.
|
|
|
|
```lua
|
|
-- Register an autocmd to listen for matugen updates
|
|
vim.api.nvim_create_autocmd("Signal", {
|
|
pattern = "SIGUSR1",
|
|
callback = auxiliary_function,
|
|
})
|
|
|
|
|
|
-- Main entrypoint on matugen reloads
|
|
local function auxiliary_function()
|
|
-- Load the matugen style file to get all the new colors
|
|
source_matugen()
|
|
|
|
-- Because reloading base16 overwrites lualine configuration, just source lualine here
|
|
dofile(os.getenv("HOME") .. '/.config/nvim/config/plugins/lualine-nvim.lua') -- path of your lualine setup
|
|
|
|
-- Any other options you wish to set upon matugen reloads can also go here!
|
|
vim.api.nvim_set_hl(0, "Comment", { italic = true })
|
|
end
|
|
```
|
|
|
|
## Matugen Config
|
|
|
|
Create an entry in matugen's `config.toml` as shown below:
|
|
|
|
```toml
|
|
[templates.neovim]
|
|
input_path = './template.lua'
|
|
output_path = '~/.config/nvim/generated.lua'
|
|
post_hook = 'pkill -SIGUSR1 nvim'
|
|
```
|
|
|
|
With any luck, your Neovim should now be stylized to match your wallpaper!
|