Skip to content

🔱 Material colorscheme for NeoVim written in Lua with built-in support for native LSP, TreeSitter and many more plugins

License

Notifications You must be signed in to change notification settings

vxio/material.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌊 material.nvim

logo

🔱 Info

A port of Material colorscheme for NeoVim written in Lua

Material.nvim is meant to be a fast and modern colorscheme written in Lua that supports a lot of the new features added to NeoVim like built-in LSP and TreeSitter

If you want the old version that uses colorbuddy.nvim, you can find it here

✨ Features

⚡️ Requirements

  • Neovim >= 0.5.0

⚓ Installation

Install via your favourite package manager:

" If you are using Vim-Plug
Plug 'marko-cerovac/material.nvim'
-- If you are using Packer
use 'marko-cerovac/material.nvim'

🐬 Usage

Enable the colorscheme:

"Vim-Script:
colorscheme material
--Lua:
require('material').set()

To enable the material-nvim theme for Lualine, simply specify it in your lualine settings: ( make sure to set the theme to 'material-nvim', as 'material' already exists built in to lualine)

require('lualine').setup {
  options = {
    -- ... your lualine config
    theme = 'material-nvim'
    -- ... your lualine config
  }
}

For a comlete guide on usage and Configuration of the theme, see :help material.nvim.

⚙️ Configuration

  • There are 5 different styles available:
    • darker
    • lighter
    • oceanic
    • palenight
    • deep ocean

Set the desired style using:

"Vim-Script:
let g:material_style = 'darker'
--Lua:
vim.g.material_style = "deep ocean"

The configuration of different options is done trough a setup function

lua << EOF
require('material').setup()
EOF

This is an example of the function with the default values

require('material').setup({

	contrast = true, -- Enable contrast for sidebars, floating windows and popup menus like Nvim-Tree
	borders = false, -- Enable borders between verticaly split windows

	popup_menu = "dark", -- Popup menu style ( can be: 'dark', 'light', 'colorful' or 'stealth' )

	italics = {
		comments = false, -- Enable italic comments
		keywords = false, -- Enable italic keywords
		functions = false, -- Enable italic functions
		strings = false, -- Enable italic strings
		variables = false -- Enable italic variables
	},

	contrast_windows = { -- Specify which windows get the contrasted (darker) background
		"terminal", -- Darker terminal background
		"packer", -- Darker packer background
		"qf" -- Darker qf list background
	},

	text_contrast = {
		lighter = false, -- Enable higher contrast text for lighter style
		darker = false -- Enable higher contrast text for darker style
	},

	disable = {
		background = false, -- Prevent the theme from setting the background (NeoVim then uses your teminal background)
		term_colors = false, -- Prevent the theme from setting terminal colors
		eob_lines = false -- Hide the end-of-buffer lines
	}

	custom_highlights = {} -- Overwrite highlights with your own
})

After passing the configuration to a setup function, make sure to enable the colorscheme:

colorscheme material
vim.cmd[[colorscheme material]]

This is an example of overwriting the default highlights (most users will never need to do this):

require('material').setup{
	custom_highlights = {
		CursorLine = '#0000FF',
		LineNr = '#FF0000'
	}
}

⛵ Functions

  • Toggle the style live without the need to exit NeoVim

toggle_style

Just call the function for style switching

"Vim-Script
:lua require('material.functions').toggle_style()
"This command toggles the style

The command can also be mapped to a key for fast style switching

"Vim-Script:
nnoremap <leader>mm :lua require('material.functions').toggle_style()<CR>
--Lua:
vim.api.nvim_set_keymap('n', '<leader>mm', [[<Cmd>lua require('material.functions').toggle_style()<CR>]], { noremap = true, silent = true })
  • Toggle the end of buffer lines ( ~ )

Call the built in function for toggling buffer lines

"Vim-Script
:lua require('material.functions').toggle_eob()
"This command toggles the end of buffer lines

The command can also be mapped to a key to toggle the lines live

"Vim-Script:
nnoremap <leader>me :lua require('material.functions').toggle_eob()<CR>
--Lua:
vim.api.nvim_set_keymap('n', '<leader>me', [[<Cmd>lua require('material.functions').toggle_eob()<CR>]], { noremap = true, silent = true })
  • Change the style to a desired one using the function change_style("desired style")
"Vim-Script:
:lua require('material.functions').change_style("palenight")
"This command changes the style to palenight

The command can also be mapped to a key for fast style switching

"Vim-Script:
nnoremap <leader>ml :lua require('material.functions').change_style('lighter')<CR>
nnoremap <leader>md :lua require('material.functions').change_style('darker')<CR>
--Lua:
vim.api.nvim_set_keymap('n', '<leader>ml', [[<Cmd>lua require('material.functions').change_style('lighter')<CR>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>md', [[<Cmd>lua require('material.functions').change_style('darker')<CR>]], { noremap = true, silent = true })

About

🔱 Material colorscheme for NeoVim written in Lua with built-in support for native LSP, TreeSitter and many more plugins

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 99.5%
  • Vim Script 0.5%