Skip to content

iamharshdabas/hyde.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

hyde.nvim

hyde.nvim keeps Neovim in sync with your HyDE setup. It reads your Kitty font and colors, feeds them into Tokyonight, and can handle the usual Neovide setup too.

It also detects whether your Kitty background is effectively light or dark so Hyde can choose better Tokyonight fallback surfaces automatically.

Minimal Config

Use this if you just want it working.

return {
  {
    "iamharshdabas/hyde.nvim",
    opts = {},
  },
  {
    "folke/tokyonight.nvim",
    lazy = false,
    priority = 1000,
    dependencies = { "hyde.nvim" },
    config = function()
      require("hyde").setup_tokyonight()
    end,
  },
}

setup_tokyonight() does the usual setup for you:

  • applies guifont
  • applies Neovide globals and keymaps when vim.g.neovide is set
  • builds the Tokyonight config from your Hyde opts
  • loads tokyonight
  • starts the theme watcher

Full Config

Use this if you want to control the Tokyonight setup yourself.

return {
  {
    "iamharshdabas/hyde.nvim",
    opts = {
      font = {
        enabled = true, -- Let Hyde build `guifont`.
        fallback = {
          family = "CaskaydiaCove Nerd Font Mono", -- Used when Kitty does not provide a font family.
          size = 12, -- Used when Kitty does not provide a font size.
        },
        hyde = {
          enabled = true, -- Read font values from Kitty.
          file_path = {
            "~/.config/kitty/theme.conf", -- Theme-level font overrides.
            "~/.config/kitty/hyde.conf", -- Hyde defaults.
          },
          family_key = "font_family", -- Kitty key for the font family.
          size_key = "font_size", -- Kitty key for the font size.
        },
      },
      palette = {
        file_path = "~/.config/kitty/theme.conf", -- Kitty theme file for Tokyonight colors.
        lightness = {
          enabled = true, -- Detect light palettes and derive darker fallback surfaces from the background.
          reduction_percent = 12, -- Clamped to 0-100 before darkening the background.
        },
        watcher = {
          enabled = true, -- Watch the theme file for changes.
          debounce = 100, -- Wait this long before reloading after a file event.
          notify = true, -- Show theme change notifications when debug is on.
        },
      },
      neovide = {
        enabled = true, -- Apply Neovide settings when running in Neovide.
        opacity = 0.9, -- Window opacity.
        hide_mouse_when_typing = true, -- Hide the mouse while typing.
        cursor_trail_size = 0.8, -- Cursor trail size.
        cursor_vfx_mode = "pixiedust", -- Cursor effect.
        opacity_keymaps = {
          enabled = true, -- Enable opacity keymaps.
          increase = "<C-A-i>", -- Increase opacity.
          decrease = "<C-A-o>", -- Decrease opacity.
          step = 0.05, -- Change per key press.
          min = 0.0, -- Lowest opacity.
          max = 1.0, -- Highest opacity.
          target = "neovide_opacity", -- `vim.g` key to update.
        },
      },
      tokyonight = {
        style = "storm", -- Tokyonight variant.
        transparent = true, -- Keep the main background transparent outside Neovide.
        styles = {
          sidebars = "transparent", -- Sidebar background style.
          floats = "transparent", -- Float background style.
        },
      },
      debug = {
        enabled = false, -- Show Hyde notifications.
      },
    },
  },
  {
    "folke/tokyonight.nvim",
    lazy = false,
    priority = 1000,
    dependencies = { "hyde.nvim" },
    opts = function()
      return require("hyde").get_tokyonight_config()
    end,
    config = function(_, opts)
      local hyde = require("hyde")

      hyde.apply_guifont()

      if vim.g.neovide then
        hyde.apply_neovide()
      end

      require("tokyonight").setup(opts)
      vim.cmd.colorscheme("tokyonight")

      hyde.start_theme_watcher(nil, function()
        hyde.apply_guifont()
        require("tokyonight").setup(hyde.get_tokyonight_config())
        vim.cmd.colorscheme("tokyonight")
      end)
    end,
  },
}

That full setup is the same flow setup_tokyonight() uses internally. The difference is that here you can change any step.

Light Mode

When Hyde detects a light Kitty background:

  • selection_background becomes the tab-related fallback color
  • Hyde reduces the effective Tokyonight background using palette.lightness.reduction_percent
  • Tokyonight transparency is forced off so the light background stays readable

API

  • require("hyde").setup(opts) stores your config and returns the merged result.
  • require("hyde").get_guifont(opts) returns the final guifont string or nil.
  • require("hyde").apply_guifont(opts) applies the resolved guifont.
  • require("hyde").get_neovide_options(opts) returns Neovide globals.
  • require("hyde").get_neovide_opacity_keymaps(opts) returns opacity keymap specs.
  • require("hyde").apply_neovide(opts) applies the Neovide globals and opacity keymaps.
  • require("hyde").get_tokyonight_opts(opts, context) returns the base Tokyonight options with Neovide handling.
  • require("hyde").get_tokyonight_palette(opts) returns the Tokyonight color overrides built from your Kitty theme.
  • require("hyde").is_light_mode(opts) returns true when Hyde detects a light Kitty background.
  • require("hyde").apply_tokyonight_palette(colors, opts) applies those overrides to a Tokyonight colors table.
  • require("hyde").get_tokyonight_config(opts, context) returns the full Tokyonight config Hyde builds.
  • require("hyde").apply_tokyonight(opts, context) sets up and loads Tokyonight.
  • require("hyde").start_theme_watcher(opts, callback) watches the configured theme file and runs your callback when it changes.
  • require("hyde").stop_theme_watcher() stops the active watcher.
  • require("hyde").setup_tokyonight(opts, context) runs the common setup for you.

About

hyde.nvim keeps Neovim in sync with your HyDE setup. It reads your Kitty font and colors, feeds them into Tokyonight, and can handle the usual Neovide setup too.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages