marko-cerovac/material.nvim

github github
tree-sitter-supported-colorscheme
star 586
stars
alert-circle 1
open issues
users 4
subscribers
git-branch 70
forks
CREATED

2021-03-21

UPDATED

21 hours ago


material.nvim

Neovim Lua

The original Material theme now available for NeoVim


🔱 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

🌊 Features

  • 5 styles to choose from

    • Oceanic 2022-04-18-01:21:38-screenshot

    • Deep ocean 2022-04-18-01:21:16-screenshot

    • Palenight 2022-04-18-01:21:33-screenshot

    • Lighter 2022-04-18-01:21:28-screenshot

    • Darker 2022-04-18-01:21:22-screenshot

⚡️ Requirements

  • Neovim >= 0.7.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:
vim.cmd 'colorscheme material'

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 = {
        sidebars = false, -- Enable contrast for sidebar-like windows ( for example Nvim-Tree )
        floating_windows = false, -- Enable contrast for floating windows
        line_numbers = false, -- Enable contrast background for line numbers
        sign_column = false, -- Enable contrast background for the sign column
        cursor_line = false, -- Enable darker background for the cursor line
        non_current_windows = false, -- Enable darker background for non-current windows
        popup_menu = false, -- Enable lighter background for the popup menu
    },

    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_filetypes = { -- Specify which filetypes get the contrasted (darker) background
        "terminal", -- Darker terminal background
        "packer", -- Darker packer background
        "qf" -- Darker qf list background
    },

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

    disable = {
        colored_cursor = false, -- Disable the colored cursor
        borders = false, -- Disable borders between verticaly split windows
        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
    },

    lualine_style = "default", -- Lualine style ( can be 'stealth' or 'default' )

    async_loading = true, -- Load parts of the theme asyncronously for faster startup (turned on by default)

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

    plugins = { -- Here, you can disable(set to false) plugins that you don't use or don't want to apply the theme to
        trouble = true,
        nvim_cmp = true,
        neogit = true,
        gitsigns = true,
        git_gutter = true,
        telescope = true,
        nvim_tree = true,
        sidebar_nvim = true,
        lsp_saga = true,
        nvim_dap = true,
        nvim_navic = true,
        which_key = true,
        sneak = true,
        hop = true,
        indent_blankline = true,
        nvim_illuminate = true,
        mini = true,
    }
})

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 = {
        LineNr = { bg = '#FF0000' }
        CursorLine = { fg = '#0000FF', underline = true },

        -- This is a list of possible values
        YourHighlightGroup = {
            fg = "#SOME_COLOR", -- foreground color
            bg = "#SOME_COLOR", -- background color
            sp = "#SOME_COLOR", -- special color (for colored underlines, undercurls...)
            bold = false, -- make group bold
            italic = false, -- make group italic
            underline = false, -- make group underlined
            undercurl = false, -- make group undercurled
            underdot = false, -- make group underdotted
            underdash = false -- make group underdotted
            striketrough = false, -- make group striked trough
            reverse = false, -- reverse the fg and bg colors
            link = "SomeOtherGroup" -- link to some other highlight group
        }
    }
}

To enable the lualine themes, first set the theme in your lualine settings to auto or material

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

Then, choose the style trough a variable called lualine_style in the theme setup function

require('material').setup({
    lualine_style = 'default' -- the default style
    or
    lualine_style = 'stealth' -- the stealth style
})

If the theme, doesn't look right, it's probably because material.nvim is being loaded before lualine, causing the other material theme that comes built-in to lualine to be used. To fix this, either load material.nvim after lualine (preferred way) or set the lualine theme to one of these two values in your lualine settings

require('lualine').setup {
  options = {
    -- ... your lualine config
    theme = 'material-nvim' -- the default style
    or
    theme = 'material-stealth' -- the stealth style
    -- ... your lualine config
  }
}

⛵ Functions

  • Use Telescope.nvim to switch styles

telescope_finder

:lua require("material.functions").find_style()
  • Cycle trough styles
    :lua require('material.functions').toggle_style()
    
  • Toggle the end of buffer lines ( ~ )
    :lua require('material.functions').toggle_eob()
    
  • Change the style to a desired one using the function change_style("desired style")
    :lua require('material.functions').change_style("palenight")