GithubHelp home page GithubHelp logo

auna93 / nvim-tundra Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sam4llis/nvim-tundra

0.0 0.0 0.0 66 KB

A theme for Neovim with support for LSP, Treesitter, Telescope, and more.

Lua 100.00%

nvim-tundra's Introduction

Tundra

Tundra is a customisable theme for Neovim with built-in support for popular Neovim plugins. Written in Lua.

syntax telescope

Features

Getting Started

Requirements

Installation

You can install this colorscheme with your favourite package manager. As an example, for vim-plug:

Plug 'sam4llis/nvim-tundra'

Usage

To use the built-in configuration, add the following to your Neovim configuration:

vim.opt.background = 'dark'
vim.cmd('colorscheme tundra')

Configuration

Tundra provides a setup(opts) function that allow you to overwrite any default settings. User settings are passed into the setup function as a Lua table. As an example, this is my personal configuration for the Tundra colorscheme:

require('nvim-tundra').setup({
  transparent_background = false,
  editor = {
    search = {},
    substitute = {},
  },
  syntax = {
    booleans = { bold = true, italic = true },
    comments = { bold = true, italic = true },
    conditionals = {},
    constants = { bold = true },
    functions = {},
    keywords = {},
    loops = {},
    numbers = { bold = true },
    operators = { bold = true },
    punctuation = {},
    strings = {},
    types = { italic = true },
  },
  diagnostics = {
    errors = {},
    warnings = {},
    information = {},
    hints = {},
  },
  plugins = {
    lsp = true,
    treesitter = true,
    cmp = true,
    context = true,
    dbui = true,
    gitsigns = true,
    telescope = true,
  },
  overwrite = {
    colors = {},
    highlights = {},
  },
})

vim.opt.background = 'dark'
vim.cmd('colorscheme tundra')

NOTE: The setup() function must be invoked before colorscheme tundra for the user's settings to be respected. You can also remove empty tables {} if you don't want to overwrite a default setting.

General Settings

General settings are independent to any syntax, editor, or plugin group.

  • transparent_background (boolean): If true, background colours are disabled on certain highlight groups to give a transparent background.

Syntax Settings

Syntax settings provide a simple interface to overwrite styles for syntactic elements, such as booleans or functions. Each field can accept any key from :h highlight-args as a boolean. Syntax settings are conventionally used to add bold = true or inverse = true to an element.

Editor Settings

Editor settings provide a simple interface to overwrite styles for Neovim editor highlights. A common use-case is to reverse the highlight arguments on the search and substitute fields. This is achieved by adding the reverse = true option to the respective field. Each field can accept any key from h highlight-args as a boolean.

Plugin Settings

Plugin settings provide a simple interface to add semantic highlights for specific plugins. By default, all plugins are disabled except for native LSP and nvim-treesitter. All other supported plugins must be explicitly opted in via the user's setup() call in their neovim configuration. As an example, to opt in Tundras' telescope.nvim highlights:

require('nvim-tundra').setup({
  -- ...
  plugins = {
    telescope = true,
  },
  -- ...
})

Customising Highlights

Get Tundra Colours

This returns a Lua table, where each key is the colour name and each value is its hexadecimal colour. Most colours have multiple shades, so you may need to specify the shade of the colour you want to use. Here's a quick example:

-- Get the 'arctic' (default) colour palette.
local cp = require('nvim-tundra.palette.arctic')

-- You can view all colours/shades using the following command.
print(vim.inspect(cp))

print(vim.inspect(cp.indigo))
-- Output: { _400 = '#DDD6FE', _500 = '#A5B4FC', _800 = '#424674', _900 = '#28304D' }

print(vim.inspect(cp.indigo._500))
-- Output: '#A5B4FC'

NOTE: Colour shades are represented in Tundra palettes as a value from 0 to 1000, where 0 is the lightest shade of the colour, and 1000 is the darkest shade of the colour. Shades will usually increment in values of 100.

Overwriting Tundra Groups

Overwriting Tundra groups is as simple as passing a new foreground (fg) and background (bg) colour into the correct field. For example, if you prefer booleans to be an indigo shade rather than the default orange, you can add the following to the setup configuration.

local cp = require('nvim-tundra.palette.arctic')

require('nvim-tundra').setup({
  -- ...
  syntax = {
    -- ...
    booleans = { fg = cp.indigo._400, bold = true, italic = true },
    -- ...
  },
  -- ...
})

vim.opt.background = 'dark'
vim.cmd('colorscheme tundra')

Hexadecimal values can also be passed into fg and bg fields if you want to add your own colours.

Overwriting Tundra Colours

If you want to change a particular colour in Tundra, you can add it to the overwrite field in the user setup() function. For example, if you want to overwrite the original sky._500 colour to make it a custom shade of blue, add the following to your user configuration:

require('nvim-tundra').setup({
  -- ...
  overwrite = {
    colors = {
      sky = {
        _500 = '#6EABCF', -- A more `oceanic` colour instead of `sky`.
      },
    },
  },
  -- ...
})

vim.opt.background = 'dark'
vim.cmd('colorscheme tundra')

Overwriting Highlight Groups

If you want fine-grained control in your Tundra configuration, you can overwrite individual highlight groups. These highlights take precedence over Tundra-defined highlight groups in the editor and syntax fields in Tundra's setup() function. For example, if you wish the TSField highlight group to be bold and have a red foreground:

require('nvim-tundra').setup({
  -- ...
  overwrite = {
    highlights = {
      TSField = { fg = '#FF0000', bold = true },
    },
  },
  -- ...
})

vim.opt.background = 'dark'
vim.cmd('colorscheme tundra')

You can also overwrite highlight groups with colours from the Tundra colour palette. Here's a quick example:

local cp = require('nvim-tundra.palette.arctic')

require('nvim-tundra').setup({
  -- ...
  overwrite = {
    highlights = {
      TSField = { fg = cp.red._400, bold = true},
    },
  },
  -- ...
})

vim.opt.background = 'dark'
vim.cmd('colorscheme tundra')

Acknowledgements

  • The Catppuccin colorscheme for Neovim, for inspiring the extensible user configuration options for Tundra.

  • The Nightfox colorscheme for Neovim, for inspiring the distinction between colors and palettes for Tundra.

  • The NvChad configuration, for inspiring the UI and highlight groups for Telescope.

nvim-tundra's People

Contributors

sam4llis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.