Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/martineausimon/nvim-xresources

A Neovim colorscheme that uses your Xresources colors
https://github.com/martineausimon/nvim-xresources

colorscheme neovim xresources

Last synced: 22 days ago
JSON representation

A Neovim colorscheme that uses your Xresources colors

Awesome Lists containing this project

README

        

# nvim-xresources

**nvim-xresources** is a colorscheme for [Neovim](https://github.com/neovim/neovim) that uses your Xresources colors.

Screenshots

* with Nord Xresources:



* with a kind of Gruvbox Xresources:



* with Manjaro i3wm Xresources:



## WHY ?

I've never really enjoyed using a colorscheme: for me, the ideal setup is the nvim default with my colors defined in Xresources. However many plugins require the use of true colors with `set termguicolors`. The concept of this plugin is to stay faithful to the colors defined in Xresources, but in true colors.

## FEATURES

This plugin aims for simplicity, though I have incorporated a few extra choices:

* **auto_light** feature: useful when Xresources only contains 8 colors
* **palette_overrides**: change palette colors
* **custom_highlight_groups() function**: override or add groups
* **contrast** option: set contrast for colors bg1, bg2, bg3 and fg1
* **:ShowPalette** cmd: Show palette colors in a floating window
* Supports **termux** colors.properties
* supports [lualine](https://github.com/nvim-lualine/lualine.nvim), [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter), [noice](https://github.com/folke/noice.nvim), [nvim-telescope](https://github.com/nvim-telescope/telescope.nvim)...

## CONTRIBUTING

This plugin is a work in progress, and there are many things missing! I am more than willing to accept pull requests to help improve it.

## INSTALL

### [lazy.nvim](https://github.com/folke/lazy.nvim)

```lua
{
'martineausimon/nvim-xresources',
lazy = false,
priority = 1000,
config = function()
require('nvim-xresources').setup({
-- Optional config:
-- xresources_path = os.getenv("HOME") .. '/.Xresources',
-- auto_light = {
-- enable = true,
-- value = 0.5,
-- exclude = {},
-- },
-- contrast = 1,
-- bold = true,
-- palette_overrides = {},
-- fallback_theme = "nord"
})
--local C = require('nvim-xresources.colors')
--require('nvim-xresources').custom_highlight_groups({ })

vim.cmd('colorscheme xresources')
end
}
```

> Note: This plugin works with `xrdb` (or `colors.properties` in Termux). You need a system configured with this, otherwise, a fallback theme will be used (default `nord`, available `tokyonight`)

## CONFIG

an example setup with Lazy. Pay attention to the order of the elements: `require('nvim-xresources.colors')` must be called after the `setup()` function

```lua
{
'martineausimon/nvim-xresources',
lazy = false,
priority = 1000,
config = function()
require('nvim-xresources').setup({
xresources_path = os.getenv("HOME") .. '/.Xresources',
auto_light = {
enable = true,
value = 0.5,
exclude = {
"light_green",
"light_blue",
}
},
contrast = 0.6,
bold = false,
palette_overrides = {
green = "#3CB371",
},
})

local C = require('nvim-xresources.colors')

require('nvim-xresources').custom_highlight_groups({
-- link to a existing group :
pythonBuiltin = "PreProc",
-- or define highlights :
pythonFunction = { guifg = C.cyan, guibg = nil, gui = C.bold, guisp = nil }, -- use "bold" if you want to bypass bold true/false option
})
vim.cmd('colorscheme xresources')
end
}
```

## USAGE

* The `:ShowPalette` command opens a floating window displaying the palette colors, listed in ascending order of brightness

* You can use colors from `nvim-xresources` in other parts of your config. In the following example, I use `nvim-xresources` colors in [nvim-lilypond-suite](https://github.com/martineausimon/nvim-lilypond-suite) config :

```lua
local C = require('nvim-xresources.colors')

require('nvls').setup({
lilypond = {
highlights = {
lilyVar = {
fg = C.blue
}
},
},
})

```

## CREDITS, INSPIRATION

[gruvbox.nvim](https://github.com/ellisonleao/gruvbox.nvim)
[nord.nvim](https://github.com/shaunsingh/nord.nvim)
[xresources-nvim](https://github.com/nekonako/xresources-nvim)
[nvim-base16](https://github.com/RRethy/nvim-base16)