Skip to content

🎨 Newpaper 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

yorik1984/newpaper.nvim

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎨 newpaper.nvim

Neovim Lua

ℹ️ Info

A fork of material.nvim colorscheme for Neovim using Papercolor color palette with small changes written in Lua. $\LaTeX$ syntax highlight get from sublime-writing-color-scheme.

newpaper.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.

Light

Dark

🌟 Features

  • TreeSitter support.
  • Support regex highlight with treesitter. Colors pick from regexr.com.
  • Extra syntax highlight and extends treesitter queries for some grammars.
  • lsp-semantic-highlight.
  • LSP Diagnostics with colors from lsp-colors.
  • Two styles to choose from:
    • Light
    • Dark
  • Lualine theme.
  • Ability to change background on sidebar windows like NvimTree, terminal etc.
  • Added functions for live theme switching without the need to restart Neovim.
  • Extras colors configs for terminal-based and GUI application.
  • Predefined presets for different filetypes.

Extra syntax highlights

Language Core syntax Treesitter queries Extra plugins Preview Code example
$\LaTeX$ πŸ‘ βœ”οΈ βœ”οΈ βœ… vimtex
Comment πŸ‘ ❌ βœ… ❌ πŸ–ΌοΈ raw code
Gitignore ❌ βœ… ❌
HTML βœ”οΈ βœ… ❌
Jinja βœ”οΈ ❌ βœ… Vim-Jinja2-Syntax
Json βœ”οΈ βœ… ❌
Liquid βœ”οΈ βœ… ❌
Log ❌ ❌ βœ… log-highlight.nvim
Lua πŸ‘ βœ”οΈ βœ… βœ”οΈ vim-lua πŸ–ΌοΈ raw code
Luadoc πŸ‘ ❌ βœ… ❌
Luap πŸ‘ ❌ βœ… ❌ raw code
Luau ❌ βœ… ❌
Markdown πŸ‘ βœ”οΈ βœ… βœ”οΈ vim-markdown πŸ–ΌοΈ raw code
Pandoc πŸ‘ βœ”οΈ ❌ βœ… vim-pandoc-syntax raw code
Python ❌ βœ… ❌
Query ❌ βœ… ❌
Rbs πŸ‘ ❌ βœ… βœ”οΈ vim-rbs
Regex πŸ‘ ❌ βœ… ❌ raw code
Ruby πŸ‘ βœ”οΈ βœ… βœ”οΈ vim-ruby πŸ–ΌοΈ raw code
Rust βœ”οΈ βœ… ❌ raw code
TOML βœ”οΈ βœ… ❌ raw code
Vim βœ”οΈ βœ… ❌
Vimdoc βœ”οΈ βœ… ❌
YAML βœ”οΈ βœ… ❌ raw code

πŸ‘ - detailed, βœ… - support and recommended as default, βœ”οΈ - support, ❌ - not support

πŸ”Œ Extra supported

filetypes plugins

plugins

⚑️ Requirements

  • Neovim >= 0.10

πŸ“¦ Installation

Install via your favorite package manager:

lazy.nvim

require("lazy").setup({
    "yorik1984/newpaper.nvim",
    priority = 1000,
    config = true,
})

vim.cmd.colorscheme("newpaper")

βš™οΈ Configuration

  • There are 2 different styles available:
    • dark
    • light

Set the desired style using:

require("newpaper").setup({
    style = "dark"
})

vim.cmd.colorscheme("newpaper")

πŸ’» Commands

All commands are aliases for vim.cmd.colorscheme("newpaper") with the optional vim.o.background setting

Command Description
:NewpaperLight Use colorscheme and change style to light mode
:NewpaperDark Use colorscheme and change style to dark mode
:Newpaper Use colorscheme without changing style

Available options

Option Default Description
style "light" The theme comes in two styles:"dark", "light" and "auto" mode. Option "auto" set style depending from vim.o.background
preset "{}" Add built-in presets per filetype or filename. Presets are predefined windows setting apply after events. by_filetype apply by FileType pattern. by_filename apply by BufEnter pattern. Separate highlight groups are used to configure the style: text settings for text filetypes. Includes a slightly altered background and a more compact appearance. task the same as text but with a classic yellow background color like in TODO documents. view the same as text but without line numbers. See: Presets default. NOTE: Pattern by_filename has a higher priority.
lightness 0 Make all supported highlight groups lighter or darker. Useful with saturation to make more beauty and eye-friendly view. Value: from -1(all colors "#000000") to 1(all colors "#FFFFFF"). Recommended value: -0.2 - 0.2
saturation 0 Change color saturation of all supported highlight groups. Useful with lightness to make more beauty and eye-friendly view. Value: from -1 to 1. Recommended value: -0.2 - 0.2
greyscale false Make all supported highlight groups in greyscale palette. Useful with lightness and saturation to make more beauty and eye-friendly view. Value: "lightness", "average", "luminosity", false. Recommended greyscale value: "luminosity"
editor_better_view true Make some interface like menu, title of editor and plugins menu bold and italic
terminal "contrast" Make :terminalbuffers and windows in different styles. Value:"bg", "contrast", "inverse", "inverse_transparent"
sidebars_contrast {} Set a contrast background on sidebar-like windows. Example: { "NvimTree", "vista_kind", "trouble" }. "NvimTree" and "trouble" groups has own highlight colors. Can be overridden separate from others sidebars
contrast_float true Make popup menus like nvim-cmp, lsp-saga have a different foreground and background
contrast_telescope true Make Telescope have a different foreground and background
operators_bold true Make booleans, escape characters, operators like =, /, *, +, -, &, %, #, ~, <, >, `
delimiters_bold false Make delimiter ,,;,:,. bold
brackets_bold false Make brackets like {}, (), [] bold
delim_rainbow_bold false Make rainbow delimiters like {}, (), [] or others bold. Use specific plugin to highlight like rainbow-delimiters.nvim
booleans "bold" Make booleans like true, false etc. bold, italic, or NONE. Value: "bold", "italic", "bold,italic", "NONE"
booleans_operators "bold" Make booleans operators like ||, & etc. bold, italic, or NONE. Value: "bold", "italic", "bold,italic", "NONE". Support only for Extended treesitter queries
keywords "bold" Make keywords like if, for, while etc. bold, italic, or NONE. Value: "bold", "italic", "bold,italic", "NONE"
doc_keywords "bold,italic" Make documenting keywords like @param, @return etc. bold, italic or NONE. Value: "bold", "italic", "bold,italic", "NONE". Only support for: treesitter-luadoc
regex "bold" Make regex bold, italic or NONE. Value: "bold", "italic", "bold,italic", "NONE"
regex_bg true Enable background color for regex capturing groups
tags "bold" Make HTML tag bold, italic, or NONE. Value: "bold", "italic", "bold,italic", "NONE"
tags_brackets_bold true Make tags delimiters like < or /> bold
tex_major "bold" Make only major tex word like\documentclass, \section, … bold, italic, or NONE. Value: "bold", "italic", "bold,italic", "NONE". Work only with vimtex
tex_operators_bold "true" Make tex operators bold
tex_brackets_bold "false" Make tex brackets like {}, [] bold
tex_math_delim_bold "false" Make tex math delimiters like \[\], \(\), $ $, $$ $$ bold
tex_keywords "NONE" Make other tex keywords bold, italic or NONE. Value: "bold", "italic", "bold,italic", "NONE"
tex_zone "italic" Make some tex ...Zone... bold, italic, or NONE. Value: "bold", "italic", "bold,italic", "NONE"
tex_arg "italic" Make some tex ...Arg... bold, italic, or NONE. Value: "bold", "italic", "bold,italic", "NONE"
error_highlight "undercurl" Make spell or tex-files errors highlighting with background, undercurl, both or NONE. Value: "bg", "undercurl", "both", "NONE"
diff_highlight "bg" Style for DiffAdd, DiffChange, DiffDelete, DiffText. Value: "fg", "bg", "both".
italic_strings true Make strings italic
italic_comments true Make comments italic
italic_doc_comments true Make comments documenting code italic
italic_functions false Make function calls and names italic
italic_variables false Make variable names and identifiers italic
borders true Enable the border between vertically split windows visible
disable_background false Disable the setting of background color so that Neovim can use your terminal background
lsp_virtual_text_bg true Enable background color for LSP virtual text
hide_eob false Hide the end of buffer lines (~)
colors {} Override the default colors and use your own. Also, override lualine colors if you have same name for more good view. See possible value in sorce code colors[11:207] and colors[211:407]
colors_advanced {} Override the advanced default colors and use your own. See possible value in source code colors[429:644]
custom_highlights {} Override the default and plugins highlights groups. Table predefine any syntax colors. Use fg,bg, sp, style style options. fg => guifg, bg => guibg, sp => guisp, style => gui. See above
lualine_bold true When true, section headers in the lualine theme will be bold
lualine_style use always vim.o.background option

Colorscheme default settings

Default Options
--- This annotation enforces that only the listed keys are present:
---   - Top-level: "preset" (Config)
---   - PresetSpec: "by_filetype" and "by_filename"
---   - PresetByKind: allowed preset names "text", "task", "view"
---
--- Use these annotations with the Lua language server / EmmyLua for stronger
--- static hints and to make intent explicit: any other keys are considered invalid.
---
--- @class PresetByKind
--- @field text string[]  @list of strings: for by_filetype => filetype names; for by_filename => glob patterns
--- @field task string[]  @list of strings: for by_filetype => filetype names; for by_filename => glob patterns
--- @field view string[]  @list of strings: for by_filetype => filetype names; for by_filename => glob patterns
--- @class PresetSpec
--- @field by_filetype PresetByKind  @only these fields ("text","task","view") are allowed in this section
--- @field by_filename PresetByKind  @only these fields ("text","task","view") are allowed in this section
--- Notes:
--- - Elements of by_filetype[...] are strings representing filetypes (e.g. "markdown", "lua").
--- - Elements of by_filename[...] are strings representing filename glob patterns (e.g. "*.TODO", "README.md").
--- - The implementation may perform runtime validation and report an error if any unexpected keys appear.
---
--- @class Defaults
--- @field style "light"|"dark"|"auto"
--- @field preset PresetSpec  @main preset configuration table (only the keys declared above are allowed)
--- @field lightness boolean|number
--- @field saturation boolean|number
--- @field greyscale "lightness"|"average"|"luminosity"|false
--- @field editor_better_view boolean
--- @field terminal string
--- @field sidebars_contrast table
--- @field contrast_float boolean
--- @field contrast_telescope boolean
--- @field operators_bold boolean
--- @field delimiters_bold boolean
--- @field brackets_bold boolean
--- @field delim_rainbow_bold boolean
--- @field booleans string
--- @field booleans_operators string
--- @field keywords string
--- @field doc_keywords string
--- @field regex string
--- @field regex_bg boolean
--- @field tags string
--- @field tags_brackets_bold boolean
--- @field tex_major string
--- @field tex_operators_bold boolean
--- @field tex_brackets_bold boolean
--- @field tex_math_delim_bold boolean
--- @field tex_keywords string
--- @field tex_zone string
--- @field tex_arg string
--- @field error_highlight "bg"|"undercurl"|"both"|"NONE"
--- @field diff_highlight "fg"|"bg"|"both"
--- @field italic_strings boolean
--- @field italic_comments boolean
--- @field italic_doc_comments boolean
--- @field italic_functions boolean
--- @field italic_variables boolean
--- @field borders boolean
--- @field disable_background boolean
--- @field lsp_virtual_text_bg boolean
--- @field hide_eob boolean
--- @field colors table
--- @field colors_advanced table
--- @field custom_highlights table
--- @field lualine_bold boolean
require("newpaper").setup({
    -- Visual / behavioral defaults
    style               = "light",
    preset              = {},
    lightness           = false,
    saturation          = false,
    greyscale           = false,
    editor_better_view  = true,
    terminal            = "contrast",
    sidebars_contrast   = {},
    contrast_float      = true,
    contrast_telescope  = true,

    -- Syntax element styling
    operators_bold      = true,
    delimiters_bold     = false,
    brackets_bold       = false,
    delim_rainbow_bold  = false,

    booleans            = "bold",
    booleans_operators  = "bold",
    keywords            = "bold",
    doc_keywords        = "bold,italic",
    regex               = "bold",
    regex_bg            = true,
    tags                = "bold",
    tags_brackets_bold  = true,

    -- TeX / LaTeX specific options
    tex_major           = "bold",
    tex_operators_bold  = true,
    tex_brackets_bold   = false,
    tex_math_delim_bold = false,
    tex_keywords        = "NONE",
    tex_zone            = "italic",
    tex_arg             = "italic",

    -- Miscellaneous
    error_highlight     = "undercurl",
    diff_highlight      = "bg",
    italic_strings      = true,
    italic_comments     = true,
    italic_doc_comments = true,
    italic_functions    = false,
    italic_variables    = false,
    borders             = true,
    disable_background  = false,
    lsp_virtual_text_bg = true,
    hide_eob            = false,

    -- Color tables and advanced settings
    colors              = {}, -- expected map<string, hex>, e.g. { bg = "#1f1f1f", fg = "#f5f5f5" }
    colors_advanced     = {}, -- like colors specific color variants / options
    custom_highlights   = {}, -- example: { MyGroup = { fg = "#000000", bg = "#FFFFFF", bold = true } }

    -- Integrations
    lualine_bold        = true,
})

Presets default

Full presets config stored in presets.lua

Tip

You can create custom autocommands based on this built-in settings

text
--- @return table<string, any>
function M.text()
    local winhl_entries = {
        "Normal:NormalText",
        "SignColumn:SignColumnText",
        "LineNr:LineNrText",
        "FoldColumn:FoldColumnText",
        "CursorLine:CursorLineText",
        "CursorLineNr:CursorLineNrText",
        "CursorLineSign:CursorLineSignText",
        "CursorLineFold:CursorLineFoldText",
        "WinBar:WinBarText",
        "WinBarNC:WinBarNCText",
        "Visual:VisualText",
        "VisualNOS:VisualNOSText",
        "NonTextVisual:NonTextVisualText",
    }

    local opts = {
        winhighlight = table.concat(winhl_entries, ","),
        signcolumn   = "yes:1",
        foldcolumn   = "auto:1",
        wrap         = true,
        linebreak    = true,
    }

    return opts
end
task
--- @return table<string, any>
function M.task()
    local winhl_entries = {
        "Normal:NormalTask",
        "SignColumn:SignColumnTask",
        "LineNr:LineNrTask",
        "FoldColumn:FoldColumnTask",
        "CursorLine:CursorLineTask",
        "CursorLineNr:CursorLineNrTask",
        "CursorLineSign:CursorLineSignTask",
        "CursorLineFold:CursorLineFoldTask",
        "WinBar:WinBarTask",
        "WinBarNC:WinBarNCTask",
        "Visual:VisualTask",
        "VisualNOS:VisualNOSTask",
        "NonTextVisual:NonTextVisualTask",
    }

    local opts = {
        winhighlight = table.concat(winhl_entries, ","),
        signcolumn   = "yes:1",
        foldcolumn   = "auto:1",
        wrap         = true,
        linebreak    = true,
    }

    return opts
end
view
--- @return table<string, any>
function M.view()
    local winhl_entries = {
        "Normal:NormalText",
        "SignColumn:SignColumnText",
        "LineNr:LineNrText",
        "FoldColumn:FoldColumnText",
        "CursorLine:CursorLineText",
        "CursorLineNr:CursorLineNrText",
        "CursorLineSign:CursorLineSignText",
        "CursorLineFold:CursorLineFoldText",
        "WinBar:WinBarText",
        "WinBarNC:WinBarNCText",
        "Visual:VisualText",
        "VisualNOS:VisualNOSText",
        "NonTextVisual:NonTextVisualText",
    }

    local opts = {
        winhighlight = table.concat(winhl_entries, ","),
        signcolumn   = "yes:1",
        foldcolumn   = "auto:1",
        number       = false,
        wrap         = true,
        linebreak    = true,
    }

    return opts
end

Colorscheme customizing

--WARN: Only this `vim.g` variables are using in config to link for lualine 

-- Example config in lua with global variables
vim.g.newpaper_colors            = { teal = "#0000FF" }
vim.g.newpaper_lualine_bold = true

require("newpaper").setup()

-- OR better with user configuration
local colors            = { teal = "#0000FF" } -- use one color for many groups
local colors_advanced   = { keyword = "#AA00AA", string = "#008800" }
local custom_highlights = {
    Float     = { fg = colors.teal }, -- prefer override by name
    Number    = { fg = "#00FF00" },   -- but hex colors also good
    rubyClass = { fg = "#00FFF0" },
    Comment   = { fg = "#FF0000", style = "italic,underline" },
}
require("newpaper").setup({
    style    = "dark",
    keywords = "italic",
    -- ...
    colors              = colors,
    colors_advanced     = colors_advanced,
    custom_highlights   = custom_highlights,
    -- ...
})

⚠️guicursor customizing

-- guicursor advansed settigs:
-- colorsheme predefine colors for various cursors type:
{
    Cursor       = { fg = newpaper.bg, bg = newpaper.cursor },     -- Character under the cursor
    nCursor      = { fg = newpaper.bg, bg = newpaper.teal },       -- Normal mode
    vCursor      = { fg = newpaper.bg, bg = newpaper.purple },     -- Visual mode
    veCursor     = { fg = newpaper.bg, bg = newpaper.darkpurple }, -- Visual mode with "selection" "exclusive" (same as "v", if not specified)
    oCursor      = { fg = newpaper.bg, bg = newpaper.navy },       -- Operator-pending mode
    iCursor      = { fg = newpaper.bg, bg = newpaper.green },      -- Insert mode
    rCursor      = { fg = newpaper.bg, bg = newpaper.magenta },    -- Replace mode
    cCursor      = { fg = newpaper.bg, bg = newpaper.darkorange }, -- Command-line Normal (append) mode
    ciCursor     = { fg = newpaper.bg, bg = newpaper.darkorange }, -- Command-line Insert mode
    crCursor     = { fg = newpaper.bg, bg = newpaper.darkorange }, -- Command-line Replace mode
    smCursor     = { fg = newpaper.bg, bg = newpaper.yellow },     -- showmatch in Insert mode
    TermCursor   = { fg = newpaper.bg, bg = newpaper.cursor },     -- active cursor in terminal
    TermCursorNC = { fg = newpaper.bg, bg = newpaper.lightgrey },  -- inactive cursor in terminal
}
-- This colors cam be using or overriding by own colors. See above.

-- init.lua example
vim.o.guicursor = "n:block-nCursor,v:block-vCursor,i:ver25-iCursor,r:hor25-rCursor,c:ver25-cCursor"

For more information see in :h guicursor

nvim-cmp-settings

Apply recommended settings

-- init.lua
vim.api.nvim_set_hl(0, "CmpItemAbbrMatch", { link = "CmpItemAbbrMatchCM" })

🎨 Lualine theme

Enable the newpaper theme for Lualine:

require("lualine").setup({
    options = {
        -- ... your lualine config
    },
    -- example config of sections
    sections = {
        lualine_b = {
            {
                "diff",
                diff_color = {
                -- specific colors from theme with bg color of section
                    added    = "GitSignsAdd",
                    modified = "GitSignsChange",
                    removed  = "GitSignsDelete",
                },
                symbols = {
                    added    = "ο‘— ",
                    modified = "ο‘™ ",
                    removed  = "ο‘˜ ",
                },
            },
        },
        lualine_x = {
            {
                "diagnostics",
                sources = { "nvim_diagnostic" },
                sections = { "error", "warn", "info", "hint" },
                diagnostics_color = {
                -- specific colors from theme with bg color of section
                    error = "LualineDiagnosticError",
                    warn  = "LualineDiagnosticWarn",
                    info  = "LualineDiagnosticInfo",
                    hint  = "LualineDiagnosticHint",
                },
                symbols = {
                    error = "ξͺ‡ ",
                    warn = " ",
                    info = "ξ©΄ ",
                    hint = "ο ΅ ",
                },
            },
        },
    }
})

Lualine theme name and style automatically using from main theme

βš™οΈ Hint

You can temporally use just only lualine theme with any others colorschemes. It also depends on vim.o.background.

-- Set bold style
vim.g.newpaper_lualine_bold = true
-- Style like in main colorscheme. Respect background option
vim.g.newpaper_lualine_style = vim.o.background -- always
-- Also you can predefine colors
vim.g.newpaper_colors = { teal = "#008080" }

-- disable `newpaper` theme
-- require("newpaper").setup()

require("lualine").setup {
    options = {
        theme = "newpaper",
        -- ... lualine config
    }
}
-- enable other colorscheme
-- ...

⚠️ More recommended configuration here: yorik1984/lualine-theme.nvim

πŸ“Ί Screenshots lualine

light

newpaper-light-normal newpaper-light-insert newpaper-light-visual newpaper-light-v_line newpaper-light-replace newpaper-light-command

dark

newpaper-dark-normal newpaper-dark-insert newpaper-dark-visual newpaper-dark-v_line newpaper-dark-v_block newpaper-dark-replace newpaper-dark-command

πŸ“Ί Screenshots

Presets

all

🎼 Languages

RUBY

Source code HERE

Treesitter

treesitter

vim-ruby

vim-ruby

LUA

Source code HERE

Treesitter treesitter

vim-lua vim-lua

MARKDOWN

Source code HERE

vim and Treesitter treesitter

COMMENT-TODO

Source code HERE

Treesitter treesitter

πŸŽ›οΈ Plugins

Source code HERE

todo-comments

Example config:
{
    keywords = {
        FIX =  { icon = "ο†ˆ", alt = { "FIXME", "BUG", "FIXIT", "ISSUE", "ERROR" } },
        TODO = { icon = "ο€Œ", alt = { "WIP" } },
        HACK = { icon = "" },
        WARN = { icon = "" },
        PERF = { icon = "ο€—" },
        NOTE = { icon = "󰎞", alt = { "INFO", "DOCS" } },
        TEST = { icon = "ο‚…" },
    },
    highlight = {
        multiline = true,
        keyword   = "bg",
        after     = "fg",
    },
}

❔ FAQ

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

Extras

Extra config with newpaper-based color palette for some terminal and GUI application.

©️ Credits

πŸ› οΈ TODO

  • Add dark style
  • Add syntax screenshots:
    • Ruby
    • Lua
    • TOML
    • YAML
    • Markdown
      • Pandoc
    • LaTeX
    • HTML
    • Python
    • COBOL
  • Add plugins screenshots:
    • todo-comments.nvim
    • LSP Diagnostics
    • Lsp Saga
    • nvim-cmp
    • Trouble
    • Telescope.nvim
    • NvimTree.lua
    • WhichKey.nvim
    • lazy.nvim
  • [-] Add extra syntax highlights:
    • $\LaTeX$
    • Ruby
    • Lua
    • TOML
    • YAML
    • Jinja
    • regex with treesitter
    • query with treesitter
    • Markdown
      • Pandoc
    • HTML
    • COBOL
    • Python
    • Rust
  • Add plugins support:

Releases

No releases published

Packages

No packages published

Languages

  • Lua 94.7%
  • Tree-sitter Query 5.3%