### Basic Setup for Nightfox.nvim Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/00-index.md Initializes the Nightfox plugin and sets the 'nightfox' colorscheme. This is the most basic way to get started. ```lua require('nightfox').setup() vim.cmd("colorscheme nightfox") ``` -------------------------------- ### Nightfox.nvim Configuration with Templates Source: https://github.com/edeneast/nightfox.nvim/blob/main/usage.md This example demonstrates how to define specs and groups using template paths for color referencing. Specs utilize palettes, and groups utilize specs. Ensure 'nightfox' is required before setup. ```lua local specs = { nightfox = { syntax = { -- Value does not start with `#` so is treated as a template. -- Since `magenta` is a `shade` object the `base` value will be used. keyword = "magenta", -- Adding either `.bright` or `.dim` will change the value conditional = "magenta.bright", number = "orange.dim", }, git = { -- A color define can also be used changed = "#f4a261", } } } -- Groups use specs as the template source local groups = { all = { -- The template path is parsed to [`syntax`, `string`]. This is like calling into a lua table like: -- `spec.syntax.string`. String = { fg = "syntax.string" }, -- If `link` is defined it will be applied over any other values defined Whitespace = { link = "Comment" } -- Specs are used for the template. Specs have their palette's as a field that can be accessed IncSearch = { bg = "palette.cyan" }, }, } require('nightfox').setup({ specs = specs, groups = groups }) ``` -------------------------------- ### Setup Nightfox with All Components Source: https://github.com/edeneast/nightfox.nvim/blob/main/doc/nightfox.txt Use the setup function as a convenience wrapper to initialize Nightfox with options, palettes, specs, and groups all at once. ```lua local options = { dim_inactive = true, } local palettes = { nightfox = { red = "#c94f6d", }, nordfox = { comment = "#60728a", }, } local specs = { nightfox = { syntax = { keyword = "magenta" } } } local groups = { all = { IncSearch = { bg = "palette.cyan" }, }, } require('nightfox').setup({ options = options, palettes = palettes, specs = specs, groups = groups, }) ``` -------------------------------- ### Complete Nightfox.nvim Configuration Example Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/09-configuration-reference.md A comprehensive example demonstrating how to configure global options, color palettes, semantic color specs, and highlight groups for Nightfox.nvim. ```lua require('nightfox').setup({ -- Global options options = { transparent = false, dim_inactive = true, terminal_colors = true, styles = { comments = "italic", keywords = "bold", functions = "bold", }, modules = { treesitter = true, native_lsp = true, telescope = true, gitsigns = true, notify = true, }, }, -- Color overrides palettes = { nightfox = { red = "#e06c75", -- Adjust red comment = "#808080", -- Adjust comments }, }, -- Semantic color overrides specs = { nightfox = { syntax = { keyword = "magenta.bright", string = "green", comment = "fg3", }, }, }, -- Group highlights groups = { all = { Comment = { style = "italic" }, Function = { style = "bold" }, }, nightfox = { Error = { fg = "red", style = "bold" }, }, }, }) ``` -------------------------------- ### Load a Compiled Theme Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/09-configuration-reference.md Use the `colorscheme` command to load a compiled theme after calling `setup()`. Several theme names are shown as examples. ```lua vim.cmd("colorscheme nightfox") -- or vim.cmd("colorscheme dayfox") vim.cmd("colorscheme duskfox") -- etc. ``` -------------------------------- ### HighlightSpec Example Usage Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/08-types-definitions.md An example demonstrating how to instantiate a HighlightSpec table with specific color and style values. ```lua { fg = "#cdcecf", bg = "#192330", style = "bold", sp = "NONE", link = "", force = false } ``` -------------------------------- ### Install Nightfox.nvim with lazy.nvim Source: https://github.com/edeneast/nightfox.nvim/blob/main/readme.md Install the nightfox.nvim plugin using the lazy.nvim package manager. ```lua { "EdenEast/nightfox.nvim" } -- lazy ``` -------------------------------- ### Setup & Configuration Functions Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/00-index.md Functions for initializing and configuring the Nightfox.nvim theme, including setting options and selecting themes. ```APIDOC ## Setup & Configuration ### `setup(opts)` #### Description Configure the theme with all available options. ### `set_options(opts)` #### Description Update global options for the theme. ### `set_fox(name)` #### Description Set the active theme name. ### `reset()` #### Description Reset theme configuration to default values. ``` -------------------------------- ### Install Nightfox.nvim with Packer Source: https://github.com/edeneast/nightfox.nvim/blob/main/readme.md Install the nightfox.nvim plugin using the Packer package manager. ```lua use "EdenEast/nightfox.nvim" -- Packer ``` -------------------------------- ### Install Nightfox.nvim with Vim-Plug Source: https://github.com/edeneast/nightfox.nvim/blob/main/readme.md Install the nightfox.nvim plugin using the Vim-Plug package manager. ```vim Plug 'EdenEast/nightfox.nvim' " Vim-Plug ``` -------------------------------- ### setup(opts) Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/01-api-reference-init.md Initializes and configures the Nightfox theme engine with various options, including palette, spec, and group overrides. This function sets up the internal configuration state and compiles the theme if necessary. ```APIDOC ## setup(opts) ### Description Initializes and configures Nightfox with options, palette overrides, spec overrides, and group overrides. ### Method `function M.setup(opts)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **opts** (table) - Optional - Configuration options table containing `options`, `palettes`, `specs`, and `groups` keys - **opts.options** (table) - Optional - Global options - **opts.palettes** (table) - Optional - Palette overrides per theme name - **opts.specs** (table) - Optional - Spec overrides per theme name - **opts.groups** (table) - Optional - Highlight group overrides ### Request Example ```lua require('nightfox').setup({ options = { transparent = false, dim_inactive = true, terminal_colors = true, }, palettes = { nightfox = { red = "#c94f6d", }, }, specs = { nightfox = { syntax = { keyword = "magenta", }, }, }, groups = { all = { Normal = { fg = "fg1", bg = "bg1" }, }, }, }) ``` ### Response #### Success Response None. Sets up internal configuration state. #### Response Example None ``` -------------------------------- ### Configuration Reference Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/00-index.md Complete guide to configuring the Nightfox theme, including options, palettes, specs, and groups. ```APIDOC ## Configuration Reference ### Description Complete guide to configuring the Nightfox theme. ### Configuration Details - Global setup function with all parameters - `options` table: all available theme settings - `palettes` customization: override colors - `specs` customization: override semantic colors - `groups` customization: override highlight definitions - Complete configuration example - Default values reference ### Use When Setting up theme configuration. ``` -------------------------------- ### Setup Nightfox.nvim Configuration Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/00-index.md Use this snippet to initialize Nightfox.nvim with global settings, color palettes, semantic color overrides, highlight groups, and module configurations. Ensure to replace `...` with your specific settings. ```lua require('nightfox').setup({ options = { ... }, -- Global settings palettes = { ... }, -- Color overrides specs = { ... }, -- Semantic color overrides groups = { ... }, -- Highlight group overrides }) ``` -------------------------------- ### Configure Custom Compile Paths Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/10-compiler-interactive.md Specify custom paths for compiled theme files and a custom file suffix using the setup function. ```lua require('nightfox').setup({ options = { compile_path = "/custom/path/nightfox", compile_file_suffix = "_compiled", }, }) ``` -------------------------------- ### nightfox.init API Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/MANIFEST.txt Core workflow functions for initializing and managing the nightfox.nvim theme. Includes setup, loading, compilation, and resetting functionalities. ```APIDOC ## nightfox.init Functions ### Description Provides core functions for setting up, loading, compiling, and resetting the nightfox theme engine. ### Functions - **setup()**: Initializes the theme engine. - **load()**: Loads the theme. - **compile()**: Compiles the theme. - **reset()**: Resets the theme to its default state. ``` -------------------------------- ### Configure Nightfox Styles Source: https://github.com/edeneast/nightfox.nvim/blob/main/doc/nightfox.txt This example demonstrates how to define custom styles for various syntax components within Nightfox. It shows how to apply attributes like 'italic' and 'bold' to different code elements. ```lua local options = { styles = { comments = "italic", functions = "italic,bold", } } ``` -------------------------------- ### Load and Apply Compiled Theme Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/01-api-reference-init.md Loads and applies the compiled theme for a specific colorscheme. This function will call setup() if it hasn't been called yet and compiles the theme if the compiled file does not exist. It prevents reloading the same theme. ```lua require('nightfox').load() -- After ":colorscheme nightfox" is called ``` -------------------------------- ### Nightfox.nvim Setup and Theme Loading Flow Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/13-architecture-overview.md Illustrates the sequence of operations when a user sets up Nightfox.nvim with custom options and later applies a colorscheme. This flow covers option setting, cache checking, compilation triggers, and final theme loading. ```text User calls: require('nightfox').setup(opts) ↓ set_options(opts.options) → config.options ↓ override.palettes = opts.palettes override.specs = opts.specs override.groups = opts.groups ↓ Compute config hash ↓ Check cache vs. hash ↓ If mismatch: compile() all themes ↓ Setup complete User runs: :colorscheme nightfox ↓ nightfox.load() ↓ Load compiled bytecode ↓ Execute bytecode (nvim_set_hl calls) ↓ Theme applied ``` -------------------------------- ### Setup Simulation Only Mode Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/11-colorblind-daltonization.md Enable colorblind simulation without permanently applying the adjustments. This is useful for testing or previewing the effects. ```lua require('nightfox').setup({ options = { colorblind = { enable = true, simulate_only = true, -- Just show simulation severity = { protan = 1.0, deutan = 0, tritan = 0, }, }, }, }) ``` -------------------------------- ### Setup Protan (Red-Blind) Adjustment Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/11-colorblind-daltonization.md Configure Nightfox to apply a full protan (red-blind) adjustment. Ensure the colorscheme is applied after setup. ```lua require('nightfox').setup({ options = { colorblind = { enable = true, simulate_only = false, severity = { protan = 1.0, -- Full protan adjustment deutan = 0, tritan = 0, }, }, }, }) vim.cmd("colorscheme nightfox") ``` -------------------------------- ### Nightfox (Dark) Theme Palette Example Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/04-api-reference-palette.md An example structure for the Nightfox dark theme palette. It defines base colors, shades, and background/foreground variations used within the Neovim theme. ```lua { meta = { name = "nightfox", light = false, }, black = Shade { base="#393b44", bright="...", dim="..." }, red = Shade { base="#c94f6d", bright="...", dim="..." }, green = Shade { base="#81b29a", bright="...", dim="..." }, yellow = Shade { base="#dbc074", bright="...", dim="..." }, blue = Shade { base="#719cd6", bright="...", dim="..." }, magenta = Shade { base="#9d79d6", bright="...", dim="..." }, cyan = Shade { base="#63cdcf", bright="...", dim="..." }, white = Shade { base="#dfdfe0", bright="...", dim="..." }, orange = Shade { base="#f4a261", bright="...", dim="..." }, pink = Shade { base="#d67ad2", bright="...", dim="..." }, comment = "#738091", bg0 = "#131a24", -- Dark bg (status line and float) bg1 = "#192330", -- Default bg bg2 = "#212e3f", -- Lighter bg (colorcolumn, folds) bg3 = "#29394f", -- Lighter bg (cursor line) bg4 = "#39506d", -- Conceal, border fg fg0 = "#d6d6d7", -- Lighter fg fg1 = "#cdcecf", -- Default fg fg2 = "#aeafb0", -- Darker fg (status line) fg3 = "#71839b", -- Darker fg (line numbers, fold columns) sel0 = "#2b3b51", -- Popup bg, visual selection bg sel1 = "#3c5372", -- Popup sel bg, search bg generate_spec = function(palette) ... end, } ``` -------------------------------- ### Define Custom Palettes and Groups for Nightfox Source: https://github.com/edeneast/nightfox.nvim/blob/main/doc/nightfox.txt This example shows how to define custom palettes as templates and groups that reference these templates. It demonstrates using shades, bright/dim variants, and linking highlight groups. ```lua -- Specs use palettes as the template source local specs = { nightfox = { syntax = { -- Value does not start with `#` so is treated as a template. -- Since `magenta` is a `shade` object the `base` value will be used. keyword = "magenta", -- Adding either `.bright` or `.dim` will change the value conditional = "magenta.bright", number = "orange.dim", }, git = { -- A color define can also be used changed = "#f4a261", } } } -- Groups use specs as the template source local groups = { all = { -- The template path is parsed to [`syntax`, `string`]. This is like calling into a lua table like: -- `spec.syntax.string`. String = { fg = "syntax.string" }, -- If `link` is defined it will be applied over any other values defined Whitespace = { link = "Comment" } -- Specs are used for the template. Specs have their palette's as a field that can be accessed IncSearch = { bg = "palette.cyan" }, }, } require('nightfox').setup({ specs = specs, groups = groups }) ``` -------------------------------- ### Nightfox Setup Function Signature Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/09-configuration-reference.md The primary function to configure Nightfox themes. It accepts an optional table of configuration options. ```lua require('nightfox').setup(opts) ``` -------------------------------- ### Customizing Nightfox.nvim Styles Source: https://github.com/edeneast/nightfox.nvim/blob/main/readme.md Example of customizing specific syntax group styles in nightfox.nvim. Only specify the options you wish to change. ```lua require('nightfox').setup({ options = { styles = { comments = "italic", keywords = "bold", types = "italic,bold", } } }) ``` -------------------------------- ### Testing Different Colorblind Severities in Nightfox.nvim Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/11-colorblind-daltonization.md Demonstrates how to test different colorblind simulation severities by reconfiguring Nightfox.nvim. This example shows how to test full protan deficiency and then full deutan deficiency, applying the colorscheme after each configuration change. ```lua -- Test full protan require('nightfox').setup({ options = { colorblind = { enable = true, severity = { protan = 1.0, deutan = 0, tritan = 0 }, }, }, }) vim.cmd("colorscheme nightfox") -- Later, test deutan require('nightfox').setup({ options = { colorblind = { enable = true, severity = { protan = 0, deutan = 1.0, tritan = 0 }, }, }, }) vim.cmd("colorscheme nightfox") ``` -------------------------------- ### reset() Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/03-api-reference-config.md Resets all configuration options to their default values. This is useful for reverting any custom settings and starting with a clean configuration. ```APIDOC ## reset() ### Description Resets all configuration options to their default values. This is useful for reverting any custom settings and starting with a clean configuration. ### Parameters None ### Request Example ```lua local config = require("nightfox.config") config.reset() -- All options return to defaults ``` ### Response #### Success Response (200) None. Restores default configuration. #### Response Example None ``` -------------------------------- ### Load and Access Highlight Groups Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/06-api-reference-group.md Load highlight groups for the current theme or generate them from a specific spec. This example demonstrates accessing individual group properties like foreground and background colors, and iterating through groups to check for links. ```lua local group = require("nightfox.group") -- Load groups for current theme local groups = group.load() -- Access specific group print(groups.Normal.fg) -- "#cdcecf" print(groups.Normal.bg) -- "#192330" print(groups.Comment.fg) -- "#738091" -- Or from spec directly local spec = require("nightfox.spec").load("dayfox") local groups = group.from(spec) for group_name, highlight in pairs(groups) do if highlight.link then print(group_name .. " -> " .. highlight.link) end end ``` -------------------------------- ### Load Highlight Groups for a Theme Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/06-api-reference-group.md Loads all highlight groups for a specified theme. If no theme name is provided, it defaults to the current theme configured in config.fox. This is a convenient way to get all highlight groups for a given theme. ```lua local groups = require("nightfox.group").load("nightfox") -- Equivalent to: -- local spec = require("nightfox.spec").load("nightfox") -- require("nightfox.group").from(spec) ``` -------------------------------- ### Override Highlight Groups with Templates Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/06-api-reference-group.md Configure custom highlight groups or override existing ones by providing a 'groups' table to the setup function. This allows for fine-grained control over the appearance of elements like 'Normal' text and 'Comment' styles. ```lua require('nightfox').setup({ groups = { all = { Normal = { fg = "fg1", bg = "bg1" }, Comment = { fg = "comment", style = "italic" }, }, nightfox = { Function = { fg = "magenta.bright", style = "bold" }, }, }, }) ``` -------------------------------- ### Customize Nightfox Theme Palette Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/12-themes-palettes.md Override specific colors like red, background, or comments within the 'nightfox' palette or apply global changes to all themes using the 'all' key. This setup is done via the require('nightfox').setup() function. ```lua require('nightfox').setup({ palettes = { -- Adjust nightfox colors nightfox = { red = "#ff0000", -- Brighten red bg1 = "#1a1f2e", -- Slightly lighter bg comment = "#60728a", -- Adjust comments }, -- Apply to all themes all = { comment = "#60728a", }, }, }) ``` -------------------------------- ### Initialize Nightfox with Options Source: https://github.com/edeneast/nightfox.nvim/blob/main/doc/nightfox.txt Initialize Nightfox with specific configuration options, such as dimming inactive windows. ```lua require('nightfox').init({ dim_inactive = true, }) ``` -------------------------------- ### Initialize and Configure Nightfox Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/01-api-reference-init.md Use this function to set up Nightfox with various configuration options, including global options, palette overrides, spec overrides, and highlight group overrides. It compiles the theme if the cache hash doesn't match the current configuration. ```lua require('nightfox').setup({ options = { transparent = false, dim_inactive = true, terminal_colors = true, }, palettes = { nightfox = { red = "#c94f6d", }, }, specs = { nightfox = { syntax = { keyword = "magenta", }, }, }, groups = { all = { Normal = { fg = "fg1", bg = "bg1" }, }, }, }) ``` -------------------------------- ### nightfox.spec API Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/MANIFEST.txt Functions for loading and managing syntax specifications, including type definitions and override examples. ```APIDOC ## nightfox.spec API ### Description Manages the loading and application of syntax specifications for semantic color mapping. ### Functions - **load(spec_name or table)**: Loads a single spec by name or a custom spec table. If no argument is provided, loads all default specs. ### Types - **SpecSyntax**: Represents syntax highlighting specifications. - **SpecDiagnostic**: Represents diagnostic highlighting specifications. - **SpecDiff**: Represents diff highlighting specifications. - **SpecGit**: Represents Git highlighting specifications. ``` -------------------------------- ### nightfox.palette API Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/MANIFEST.txt Functions for loading and managing color palettes, including structure definitions and override examples. ```APIDOC ## nightfox.palette API ### Description Handles the loading and management of color palettes used by the theme. ### Functions - **load(palette_name or table)**: Loads a single palette by name or a custom palette table. If no argument is provided, loads all default palettes. ### Structure Defines the structure and type definitions for palettes, including color shades and specific fields. ``` -------------------------------- ### Using Nightfox Utility Functions Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/07-api-reference-utility.md Demonstrates how to require and use the environment detection flags from the nightfox.util module to adapt behavior based on the runtime environment. ```lua local util = require("nightfox.util") if util.is_windows then print("Running on Windows") end if util.is_nvim then print("Running on Neovim") end print("Cache home: " .. util.cache_home) ``` -------------------------------- ### Switching Neovim Themes at Runtime Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/12-themes-palettes.md Demonstrates how to change the active Neovim colorscheme either by executing a Vim command or by using the plugin's programmatic API. ```lua -- Change theme vim.cmd("colorscheme dayfox") -- Or programmatically require('nightfox.config').set_fox("dayfox") require('nightfox').load() ``` -------------------------------- ### Get Configuration Hash Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/03-api-reference-config.md Calculates and returns a hash value representing the current configuration state. This can be used for caching or comparison purposes. ```lua local config = require("nightfox.config") local h = config.hash() ``` -------------------------------- ### Configuration Module Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/00-index.md Global theme configuration and settings management. ```APIDOC ## Configuration Module ### Description Global theme configuration and settings management. ### Functions - `set_options(opts)` — Set theme options - `set_fox(name)` — Select active theme - `reset()` — Restore defaults - `get_compiled_info()` — Get compiled file paths - `hash()` — Compute configuration hash ### Options Reference Includes descriptions for: - `compile_path`, `transparent`, `terminal_colors`, `dim_inactive` - `styles` — Text attributes per syntax element - `inverse` — Reverse video toggles - `colorblind` — CVD simulation/daltonization - `modules` — Plugin integration configuration ### Use When Configuring theme behavior or understanding options. ``` -------------------------------- ### Nightfox Spec Structure Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/05-api-reference-spec.md Provides an example of the structure of a nightfox.nvim spec, including color definitions for various UI elements and syntax highlighting. ```lua { bg0 = "#131a24", bg1 = "#192330", bg2 = "#212e3f", bg3 = "#29394f", bg4 = "#39506d", fg0 = "#d6d6d7", fg1 = "#cdcecf", fg2 = "#aeafb0", fg3 = "#71839b", sel0 = "#2b3b51", sel1 = "#3c5372", syntax = { bracket = "#aeafb0", builtin0 = "#c94f6d", builtin1 = "#63cdcf", builtin2 = "#f4a261", builtin3 = "#c94f6d", comment = "#738091", conditional = "#c49e9d", -- bright magenta const = "#f4a261", dep = "#71839b", field = "#719cd6", func = "#9cbff0", -- bright blue ident = "#63cdcf", keyword = "#9d79d6", number = "#f4a261", operator = "#aeafb0", preproc = "#f198f5", -- bright pink regex = "#dbc074", statement = "#9d79d6", string = "#81b29a", type = "#dbc074", variable = "#dfdfe0", }, diag = { error = "#c94f6d", warn = "#dbc074", info = "#719cd6", hint = "#81b29a", ok = "#81b29a", }, diag_bg = { error = "#2e1e2a", -- blended error warn = "#2d2a1f", -- blended warn info = "#1f2530", -- blended info hint = "#1f2a24", -- blended hint ok = "#1f2a24", }, diff = { add = "#1f2a24", delete = "#2e1e2a", change = "#1f2530", text = "#1f2530", }, git = { add = "#81b29a", removed = "#c94f6d", changed = "#719cd6", }, palette = { ... }, -- Reference to source palette } ``` -------------------------------- ### Nightfox.nvim Module Hierarchy Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/13-architecture-overview.md Overview of the main user-facing functions in the entry point module `lua/nightfox/init.lua`. ```lua nightfox.init ├── setup(opts) -- Configure theme ├── load(opts) -- Load compiled theme ├── compile() -- Compile all themes to bytecode └── reset() -- Reset configuration to defaults ``` -------------------------------- ### Override Nightfox Palettes Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/04-api-reference-palette.md Shows how to override existing palettes or apply overrides to all themes during the Nightfox setup. This allows for custom color definitions. ```lua require('nightfox').setup({ palettes = { nightfox = { red = "#ff0000", -- Override entire color blue = { -- Or override just base/bright/dim base = "#0000ff", bright = "#4444ff", }, }, all = { -- Apply to all themes comment = "#60728a", }, }, }) ``` -------------------------------- ### Customize Nightfox.nvim Colorscheme Source: https://github.com/edeneast/nightfox.nvim/blob/main/readme.md This snippet demonstrates how to override default palettes, specs, and groups to customize the Nightfox.nvim colorscheme. Ensure setup is called before loading the colorscheme. ```lua -- Palettes are the base color defines of a colorscheme. -- You can override these palettes for each colorscheme defined by nightfox. local palettes = { -- Everything defined under `all` will be applied to each style. all = { -- Each palette defines these colors: -- black, red, green, yellow, blue, magenta, cyan, white, orange, pink -- -- These colors have 3 shades: base, bright, and dim -- -- Defining just a color defines it's base color red = "#ff0000", }, nightfox = { -- A specific style's value will be used over the `all`'s value red = "#c94f6d", }, dayfox = { -- Defining multiple shades is done by passing a table blue = { base = "#4d688e", bright = "#4e75aa", dim = "#485e7d" }, }, nordfox = { -- A palette also defines the following: -- bg0, bg1, bg2, bg3, bg4, fg0, fg1, fg2, fg3, sel0, sel1, comment -- -- These are the different foreground and background shades used by the theme. -- The base bg and fg is 1, 0 is normally the dark alternative. The others are -- incrementally lighter versions. bg1 = "#2e3440", -- sel is different types of selection colors. sel0 = "#3e4a5b", -- Popup bg, visual selection bg sel1 = "#4f6074", -- Popup sel bg, search bg -- comment is the definition of the comment color. comment = "#60728a", }, } -- Spec's (specifications) are a mapping of palettes to logical groups that will be -- used by the groups. Some examples of the groups that specs map would be: -- - syntax groups (functions, types, keywords, ...) -- - diagnostic groups (error, warning, info, hints) -- - git groups (add, removed, changed) -- -- You can override these just like palettes local specs = { -- As with palettes, the values defined under `all` will be applied to every style. all = { syntax = { -- Specs allow you to define a value using either a color or template. If the string does -- start with `#` the string will be used as the path of the palette table. Defining just -- a color uses the base version of that color. keyword = "magenta", -- Adding either `.bright` or `.dim` will change the value conditional = "magenta.bright", number = "orange.dim", }, git = { -- A color define can also be used changed = "#f4a261", }, }, nightfox = { syntax = { -- As with palettes, a specific style's value will be used over the `all`'s value. operator = "orange", }, }, } -- Groups are the highlight group definitions. The keys of this table are the name of the highlight -- groups that will be overridden. The value is a table with the following values: -- - fg, bg, style, sp, link, -- -- Just like `spec` groups support templates. This time the template is based on a spec object. local groups = { -- As with specs and palettes, the values defined under `all` will be applied to every style. all = { -- If `link` is defined it will be applied over any other values defined Whitespace = { link = "Comment" }, -- Specs are used for the template. Specs have their palette's as a field that can be accessed IncSearch = { bg = "palette.cyan" }, }, nightfox = { -- As with specs and palettes, a specific style's value will be used over the `all`'s value. PmenuSel = { bg = "#73daca", fg = "bg0" }, }, } require("nightfox").setup({ palettes = palettes, specs = specs, groups = groups }) -- setup must be called before loading vim.cmd("colorscheme nightfox") ``` -------------------------------- ### Get Harsh Shade Variant Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/07-api-reference-utility.md The Shade:harsh() method returns the high-contrast shade variant. It returns the `.dim` field for light themes and the `.bright` field for dark themes. ```lua function Shade:harsh() -> string ``` -------------------------------- ### Load and Access Nightfox Palette Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/04-api-reference-palette.md Demonstrates how to load a specific Nightfox palette and access its color variants and background colors. Also shows how to generate a spec and list available themes. ```lua local Palette = require("nightfox.palette") -- Get nightfox palette local pal = Palette.load("nightfox") -- Access shade variants print(pal.red.base) -- "#c94f6d" print(pal.red.bright) -- Brighter red print(pal.red.dim) -- Darker red -- Access background colors print(pal.bg1) -- "#192330" -- Generate spec for this palette local spec = pal.generate_spec(pal) -- List all available themes for _, name in ipairs(Palette.foxes) do print(name) end ``` -------------------------------- ### Setup Multiple Colorblind Adjustments Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/11-colorblind-daltonization.md Configure Nightfox to apply a combination of protan and deutan adjustments with specified severities. This allows for simulating mild degrees of multiple color vision deficiencies. ```lua require('nightfox').setup({ options = { colorblind = { enable = true, severity = { protan = 0.3, -- 30% protan deutan = 0.2, -- 20% deutan tritan = 0, }, }, }, }) ``` -------------------------------- ### Color.new(opts) / Color(opts) Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/02-api-reference-color.md Creates a Color instance from various input formats including hex strings/numbers, RGBA, HSV, and HSL tables. ```APIDOC ## Color.new(opts) / Color(opts) ### Description Create a Color instance from various input formats. ### Parameters #### Path Parameters * **opts** (string|number|table) - Required - Color definition: hex string/number, RGBA table, HSV table, or HSL table ### Input Formats - `Color("#ff0000")` or `Color(0xff0000)` — Hex color - `Color({red=255, green=0, blue=0, alpha=1})` — RGBA [0,255], alpha [0,1] - `Color({hue=0, saturation=100, value=100})` — HSV - `Color({hue=0, saturation=100, lightness=50})` — HSL ### Example ```lua local Color = require("nightfox.lib.color") -- From hex string local red = Color("#ff0000") -- From hex number local blue = Color(0x0000ff) -- From RGBA local green = Color({red=0, green=255, blue=0, alpha=1}) -- From HSV local yellow = Color({hue=60, saturation=100, value=100}) -- From HSL local cyan = Color({hue=180, saturation=100, lightness=50}) ``` ``` -------------------------------- ### Load and Access Nightfox Specs Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/05-api-reference-spec.md Demonstrates how to load individual or all specs using the `nightfox.spec` module. Access syntax, diagnostic, and diff colors for a specific theme or iterate through all loaded themes. ```lua local spec = require("nightfox.spec") -- Load spec local s = spec.load("nightfox") -- Access syntax colors print("Keywords:", s.syntax.keyword) print("Strings:", s.syntax.string) print("Comments:", s.syntax.comment) -- Access diagnostic colors print("Error:", s.diag.error) print("Warning:", s.diag.warn) -- Access diff colors print("Added lines:", s.diff.add) print("Removed lines:", s.diff.delete) -- Load all specs at once local all_specs = spec.load() for theme_name, theme_spec in pairs(all_specs) do print(theme_name, "keyword color:", theme_spec.syntax.keyword) end ``` -------------------------------- ### load(opts) Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/01-api-reference-init.md Loads and applies the compiled theme for a specific colorscheme. It handles theme compilation if the compiled file does not exist and ensures the theme is applied correctly. ```APIDOC ## load(opts) ### Description Loads and applies the compiled theme for a specific colorscheme. ### Method `function M.load(opts)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **opts** (table) - Optional - Options table containing `output_path` and `file_suffix` - **opts.output_path** (string) - Optional - Override compile output path - **opts.file_suffix** (string) - Optional - Override compiled file suffix ### Request Example ```lua require('nightfox').load() -- After `:colorscheme nightfox` is called ``` ### Response #### Success Response None. Applies compiled theme to Vim/Neovim. #### Response Example None ``` -------------------------------- ### Get Subtle Shade Variant Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/07-api-reference-utility.md The Shade:subtle() method returns the appropriate shade variant for the current theme. It returns the `.bright` field for light themes and the `.dim` field for dark themes. ```lua function Shade:subtle() -> string ``` -------------------------------- ### Nightfox.nvim Override System Module Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/13-architecture-overview.md Explains the singleton override system in `lua/nightfox/override.lua` for user customizations. ```lua override (metatable-based singleton) ├── palettes -- Palette overrides ├── specs -- Spec overrides ├── groups -- Group overrides ├── has_override -- Flag if overrides set ├── reset() -- Clear overrides └── hash() -- Overrides hash ``` -------------------------------- ### Enable Interactive Configuration Reloading Source: https://github.com/edeneast/nightfox.nvim/blob/main/usage.md Execute this command to attach an autocmd that reloads Nightfox's configuration upon saving the current buffer. This is useful for making and seeing changes to your Nightfox setup in real-time. ```vim NightfoxInteractive ``` -------------------------------- ### Accessing Palette Information Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/05-api-reference-spec.md Demonstrates how to load a nightfox.nvim spec and access a specific color from its palette. ```lua local spec = require("nightfox.spec").load("nightfox") print(spec.palette.red.base) ``` -------------------------------- ### Color Manipulation with Nightfox Color Library Source: https://github.com/edeneast/nightfox.nvim/blob/main/readme.md Utilize Nightfox's internal color library to create, blend, and modify colors. Examples include creating colors from hex codes, blending, and adjusting brightness. ```lua local palette = require('nightfox.palette').load('nightfox') local Color = require("nightfox.lib.color") local bg = Color.from_hex(palette.bg1) local red = Color.from_hex("#ff0000") -- Blend the bg with red. The blend factor is from 0 to 1 -- with 0 being full bg and 1 being full red local red_bg = bg:blend(red, 0.2) print(red_bg:to_css()) -- "#471c26" -- Brighten bg by adding 10 to the value of the color as a hsv local alt_bg = bg:brighten(10) print(vim.inspect(alt_bg:to_hsv())) -- { -- hue = 213.91304347826, -- saturation = 47.916666666667, -- value = 28.823529411765 -- } ``` -------------------------------- ### Main Entry Point API Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/00-index.md Functions exposed at the package level for configuring, loading, compiling, and resetting the Nightfox theme. ```APIDOC ## Main Entry Point API ### Description Functions exposed at package level for configuring, loading, compiling, and resetting the Nightfox theme. ### Functions - `setup(opts)` — Configure theme with options and overrides - `load(opts)` — Load and apply compiled theme - `compile()` — Compile all themes to bytecode - `reset()` — Clear configuration and reset to defaults ### Use When Setting up Nightfox or understanding the core workflow. ``` -------------------------------- ### Customizing Nightfox with Custom Palettes and Specs Source: https://github.com/edeneast/nightfox.nvim/blob/main/readme.md Extend Nightfox with custom color values in palettes and specs to differentiate UI elements. This example shows how to define a custom 'duskfox' palette and override the 'inactive' spec for it. ```lua require("nightfox").setup({ palettes = { -- Custom duskfox with black background duskfox = { bg1 = "#000000", -- Black background bg0 = "#1d1d2b", -- Alt backgrounds (floats, statusline, ...) bg3 = "#121820", -- 55% darkened from stock sel0 = "#131b24", -- 55% darkened from stock }, }, specs = { all = { inactive = "bg0", -- Default value for other styles }, duskfox = { inactive = "#090909", -- Slightly lighter then black background }, }, groups = { all = { NormalNC = { fg = "fg1", bg = "inactive" }, -- Non-current windows }, }, }) ``` -------------------------------- ### compile() Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/01-api-reference-init.md Compiles all available themes into bytecode files, optimizing them for faster loading. This function iterates through all defined fox styles and generates the necessary compiled files. ```APIDOC ## compile() ### Description Compile all available themes into bytecode files for fast loading. ### Method `function M.compile()` ### Parameters None ### Request Example ```lua require('nightfox').compile() -- Run from command line with: :NightfoxCompile ``` ### Response #### Success Response None. Generates compiled theme files. #### Response Example None ``` -------------------------------- ### Load Single or All Specs Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/05-api-reference-spec.md Loads a single highlight specification by theme name or all specifications if no name is provided. It applies global and theme-specific overrides and attaches the palette reference to the returned spec. ```lua function M.load(name) -> Spec | table ``` ```lua local spec = require("nightfox.spec") -- Load single spec local nightfox_spec = spec.load("nightfox") print(nightfox_spec.syntax.keyword) -- "#9d79d6" -- Load all specs local all = spec.load() for name, s in pairs(all) do print(name, s.syntax.comment) end ``` -------------------------------- ### Get Compiled Theme File Paths Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/03-api-reference-config.md Retrieves the directory path and full file path for compiled theme files. Options can be provided to override default output paths, file suffixes, or theme names. ```lua local config = require("nightfox.config") local path, file = config.get_compiled_info({name = "nightfox"}) -- path = "~/.cache/nvim/nightfox" -- file = "~/.cache/nvim/nightfox/nightfox_compiled" ``` -------------------------------- ### Nightfox.nvim Compiler Module Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/13-architecture-overview.md Explains the compilation process for theme definitions to bytecode in `lua/nightfox/lib/compiler.lua`. ```lua compiler └── compile(opts) -- Compile theme to bytecode ``` -------------------------------- ### Configure Styles Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/03-api-reference-config.md Maps syntax element styles like bold, italic, or underline. Use 'NONE' for no style, or comma-separated combinations. ```lua styles = { comments = "NONE", conditionals = "NONE", constants = "NONE", functions = "NONE", keywords = "NONE", numbers = "NONE", operators = "NONE", preprocs = "NONE", strings = "NONE", types = "NONE", variables = "NONE", } ``` ```lua styles = { comments = "italic", keywords = "bold", functions = "bold,italic", } ``` -------------------------------- ### Create Color Instance Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/02-api-reference-color.md Instantiate a Color object using various input formats like hex strings, hex numbers, RGBA tables, HSV tables, or HSL tables. The constructor can be called directly or via the metatable's __call. ```lua local Color = require("nightfox.lib.color") -- From hex string local red = Color("#ff0000") -- From hex number local blue = Color(0x0000ff) -- From RGBA local green = Color({red=0, green=255, blue=0, alpha=1}) -- From HSV local yellow = Color({hue=60, saturation=100, value=100}) -- From HSL local cyan = Color({hue=180, saturation=100, lightness=50}) ``` -------------------------------- ### Nightfox.nvim Theme Loading and Application Flow Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/13-architecture-overview.md Describes the process initiated by the `:colorscheme nightfox` command, focusing on loading pre-compiled bytecode and applying highlight groups to the editor. ```text :colorscheme nightfox ↓ nightfox.load() ↓ Get compiled path from config ↓ loadfile(path) → function ↓ Call function() ↓ For each group: ├─ vim.api.nvim_set_hl(0, group_name, highlight_spec) └─ Sets colors, styles, links ↓ Theme applied to editor ``` -------------------------------- ### Compile All Nightfox Themes Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/10-compiler-interactive.md Use the :NightfoxCompile command to compile all 7 themes to bytecode. This is a one-time operation or can be used to refresh all themes. ```lua require('nightfox').compile() ``` ```vim :NightfoxCompile ``` -------------------------------- ### modules.native_lsp Source: https://github.com/edeneast/nightfox.nvim/blob/main/doc/nightfox.txt Configuration options for the native_lsp module, enabling the module and controlling the virtual text background color. ```APIDOC ## modules.native_lsp ### Description This module sets highlight groups from neovim’s builtin `lsp`. ### Parameters #### Configuration Options - **enable** (boolean) - Default: `true` - Enable the module to be included. - **background** (boolean) - Default: `true` - Set virtual text background color. ``` -------------------------------- ### Enable Module Defaults Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/03-api-reference-config.md Enables all module highlight groups by default. Defaults to true. ```lua module_default = true ``` -------------------------------- ### Set Compile Path Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/03-api-reference-config.md Specifies the directory where compiled theme bytecode will be stored. This uses Neovim's standard cache path. ```lua compile_path = vim.fn.stdpath("cache") .. "/nightfox" ``` -------------------------------- ### Loading & Compilation Functions Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/00-index.md Functions for loading, compiling, and attaching theme configurations, as well as triggering reloads. ```APIDOC ## Loading & Compilation ### `load(opts)` #### Description Load and apply the compiled theme. ### `compile()` #### Description Compile all themes to bytecode. ### `attach()` #### Description Enable real-time reload mode. ### `execute()` #### Description Trigger a theme reload (called by autocmd). ``` -------------------------------- ### Ensure Directory Exists (Recursive) Source: https://github.com/edeneast/nightfox.nvim/blob/main/_autodocs/07-api-reference-utility.md This function creates a directory at the specified path, including any necessary parent directories, if it does not already exist. It's useful for setting up configuration or cache directories. ```lua local util = require("nightfox.util") util.ensure_dir(vim.fn.stdpath("cache") .. "/nightfox") ```