Skip to content

Latest commit

 

History

History
187 lines (138 loc) · 5.45 KB

colors.md

File metadata and controls

187 lines (138 loc) · 5.45 KB

Colors and Highlights

English | 中文

You can change the colors and highlights.

Color Design Principles

  • Subject color: blue
  • Second color: green
  • Search/Match color: orange

Color Layers

The priority from high to low:

Color Space

The colors are desiged based on Display P3 color space. It works for MacOS and iTerm2 users.

If your nvim colors looks different from below picture. Your terminal is not under Display P3 color space. You may try sRGB colors.

The color space is managed by your terminal application and operator system. You should choose the right color space for your environment.

Current one.nvim provides Display P3 and sRGB color presets. And use Display P3 presets by default. You can use sRGB presets like below codes.

require('one').setup {
  config = {
    colors = require('one.colors.srgb')
  }
}

For Kitty users, you should set macos_colorspace displayp3 in kitty config. Or set macos_colorspace srgb and use the sRGB color presets.

For windows users, read Microsoft - About Color Management and Windows Central - How to find the right color profile for your monitor using Windows 10. (Even though one.nvim not work for windows users for current)

The background, frontground, cursorline colors

Change basic colors via config.colors.

Default color configs is defined in ../lua/one/colors/display-p3.lua.

require('one').setup {
  config = {
    colors = { -- basic colors
      white = '#BEC0C4', -- frontground
      black = '#15181D', -- background
      cursorLine = '#252931',
    },
  }
}

The highlights for plugins

Override plugin highlights via plugins.

require('one').setup {
  plugins = {
    {
      'stevearc/aerial.nvim',
      highlights = {
        AerialLine = { bg = 'green' },
      }
    },
  },
}

The syntax highlights

It's highly dependent on nvim-treesitter. The nvim-treesitter will set highlights for each syntax. See the treesitter highlights and colors/highlights.

If syntax highlights not work, try to reinstall your treesitter parsers. Read doc/treesitter.md for troubleshooting.

NOTE: these syntax highlights are disabled for treesitter

The markdown syntax highlights are disabled for treesitter (See config.treesitter.highlight.disable). But its syntax parser is still working. Its syntax highlights are defined in lua/one/plugins/markdown/highlights.lua .

The help syntax highlights are disabled for treesitter, while using nvim builtin highlights.

Theme

Default theme is 'onedarkpro'.

Theme: onedarkpro

require('one').setup {
  config = {
    theme = {
      use = 'onedarkpro',
      -- The onedarkpro plugin provides four themes.
      onedarkpro = {
        theme = 'onedark', -- 'onelight', 'onedark_vivid', 'onedark_dark'

        -- You can override options
        -- Options see https://github.com/olimorris/onedarkpro.nvim#wrench-configuration
        colors = {},
        highlights = {},
        plugins = {},
        styles = {},
        options = {},
      }
    }
  },
}

Theme: material

require('one').setup {
  config = {
    theme = {
      use = 'material',
      -- The material plugin provides five themes.
      material = {
        style = 'darker', -- 'darker', 'lighter', 'oceanic', 'palenight' 'deep ocean'
        -- Options see https://github.com/marko-cerovac/material.nvim
      }
    }
  },
}

Disable one.nvim theme

You can disable theme by config.theme.use = false.

If you prefer tokyonight.nvim, edit your init.lua like below codes.

require('one').setup {
  config = {
    theme = { use = false },
  },

  plugins = {
    { 'onedarkpro', disable = true },

    {
      'folke/tokyonight.nvim',

      config = function(config)
        local conf = config.tokyonight
        vim.cmd('colorscheme ' .. conf.colorscheme)
        require('tokyonight').setup(conf.setup)
      end,

      defaultConfig = {
        'tokyonight',
        {
          colorscheme = 'tokyonight', -- https://github.com/folke/tokyonight.nvim#-usage
          setup = {}, -- https://github.com/folke/tokyonight.nvim#%EF%B8%8F-configuration
        },
      },
    },
  },
}

But some places do not look good, that you need to solve them by yourself.