Skip to content

sixlive/horizon.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

horizon.nvim

logo

A neovim implementation of the Horizon theme.

Status

Some highlights are still being finalised so there may be some changes to the theme in the near future 🙏.

Screenshots

image

image

Installation

-- packer.nvim
use {"akinsho/horizon.nvim", tag = "*"}

-- lazy.nvim
{ "akinsho/horizon.nvim", version = "*" }

vim.cmd.colorscheme('horizon')

-- To change the theme variant
vim.o.background = "dark" -- or "light"

Highlight overrides

You might want to tweak the highlights used by this theme to your preferences. This is easily achievable in your neovim config by using a ColorScheme autocommand.

vim.api.nvim_create_autocommand('ColorScheme', {
  callback = function()
    -- see :h nvim_set_hl for more details
    vim.api.nvim_set_hl('CursorLine', { bg = '#1e1e1e', fg = '#ffffff', underline = true })
  end
})

However as a convenience you can also use the overrides option to specify any changes e.g.

{
  "akinsho/horizon.nvim",
  opts = {
    overrides = {
      colors = {
        CursorLine = { bg = '#1e1e1e', fg = '#ffffff', underline = true }
      }
    }
  },
}

The options are exactly the same as those passed to the nvim_set_hl function as ultimately that is exactly what happens.

Plugin integrations

Custom highlights for plugin's can be enabled or disabled using the setup options for this plugin.

{
  "akinsho/horizon.nvim",
  opts = {
    plugins = {
      cmp = true,
      indent_blankline = true,
      nvim_tree = true,
      telescope = true,
      which_key = true,
      barbar = true,
      notify = true,
      symbols_outline = true,
      neo_tree = true,
      gitsigns = true,
      crates = true,
      hop = true,
      navic = true,
      quickscope = true,
      flash = true,
    }
  },
}

Currently supported plugins are:

  • cmp.nvim
  • indent-blankline.nvim
  • nvim-tree
  • telescope.nvim
  • which-key.nvim
  • barbar.nvim
  • notify.nvim
  • symbols-outline.nvim
  • neo-tree.nvim
  • gitsigns.nvim
  • crates.nvim
  • hop.nvim
  • navic.nvim
  • quickscope.nvim
  • flash.nvim

Contributing

Because this plugin seeks to adhere to the source material closely, it pulls in the original themes json templates located in build/{dark,light}/*.json. VSCode specifies colour values as 8 digit hex which is not supported by neovim/terminals as they do not support alpha (opacity) values. To get around this the json files are parsed and the alpha values are used as the basis for blending the colour with the background colour to approximate opacity.

To contribute to the theme you can:

1. Change how color values are mapped

from vscode to neovim i.e. there is a mapping maintained in the build script i.e. build/convert.lua called theme_mapping this maps a colour value from vscode to neovim. These obviously do not strictly match but by reading through theme docs, you determine if a colour might be a good link for another in neovim e.g. editorLineNumber.foreground maps well onto LineNr in neovim.

2. Override how a colour is used

Each variant of the theme has an overrides.json file which is the same format as the template.json which is taken from horizon.nvim this can be used to change what the value of a colour is if there is a strong reason to deviate from the upstream by actually changing the colour that it uses for something that we map.

3. Add a custom colour intended for neovim only

In some cases the upstream theme does not have a colour that fits well with a neovim highlight group because the concept might not even exist in neovim. In most cases the best thing to do is to use a color from the theme's palette which is in the generated file i.e. lua/horizon/palette-{dark,light}.lua however if no colour there is suitable then in extremis a colour can be added to the get_custom_highlights function in lua/horizon/theme.lua.

Credit & References

About

Horizon Theme - Neovim Edition 🌅

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 99.8%
  • Makefile 0.2%