### Install OneDarkPro with Package Managers Source: https://context7.com/olimorris/onedarkpro.nvim/llms.txt Installation examples for popular Neovim package managers. ```lua -- Installation with lazy.nvim { "olimorris/onedarkpro.nvim", priority = 1000, -- Ensure it loads first config = function() require("onedarkpro").setup({ -- Your configuration options here }) vim.cmd("colorscheme onedark") end, } ``` ```lua -- Installation with packer.nvim use { "olimorris/onedarkpro.nvim", config = function() vim.cmd("colorscheme onedark") end } ``` ```vim -- Vim-Plug installation -- In your init.vim: -- Plug 'olimorris/onedarkpro.nvim' -- colorscheme onedark ``` -------------------------------- ### Configure OneDarkPro with setup() Source: https://context7.com/olimorris/onedarkpro.nvim/llms.txt The setup function allows for deep customization of colors, highlights, syntax styles, and plugin integrations. Call this before applying the colorscheme. ```lua require("onedarkpro").setup({ -- Override default colors or create custom colors colors = { red = "#FF0000", my_custom_color = "#f44336", -- Theme-specific color overrides onedark = { bg = "#1e2127" }, onelight = { bg = "#f0f0f0" }, }, -- Override or create highlight groups highlights = { Comment = { fg = "${my_custom_color}", italic = true }, Directory = { bold = true }, -- Create custom highlight groups MyCustomGroup = { fg = "${red}", bg = "${bg}" }, -- Disable specific highlight groups ["@lsp.type.comment"] = {}, }, -- Configure syntax element styles (NONE, bold, italic, bold,italic) styles = { types = "NONE", methods = "NONE", numbers = "NONE", strings = "NONE", comments = "italic", keywords = "bold,italic", constants = "NONE", functions = "italic", operators = "NONE", variables = "NONE", parameters = "NONE", conditionals = "italic", virtual_text = "NONE", }, -- Enable/disable filetype-specific highlighting filetypes = { all = false, -- Disable all filetypes first markdown = true, -- Then enable specific ones python = true, lua = true, javascript = true, typescript = true, }, -- Enable/disable plugin highlighting plugins = { all = false, -- Disable all plugins first treesitter = true, -- Enable specific plugins nvim_lsp = true, telescope = true, gitsigns = true, nvim_cmp = true, }, -- Theme options options = { cursorline = true, -- Enable cursorline highlighting transparency = false, -- Use transparent background terminal_colors = true, -- Apply theme to :terminal lualine_transparency = false, -- Transparent lualine center highlight_inactive_windows = true, -- Dim inactive windows }, }) -- Apply the colorscheme vim.cmd("colorscheme onedark") ``` -------------------------------- ### Install OneDarkPro.nvim with Lazy Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Install the OneDarkPro.nvim theme using the Lazy package manager. Ensure it loads with high priority. After installation, activate the theme by setting the colorscheme to 'onedark'. ```lua -- Lazy { "olimorris/onedarkpro.nvim", priority = 1000, -- Ensure it loads first } -- somewhere in your config: vim.cmd("colorscheme onedark") ``` -------------------------------- ### Install OneDarkPro.nvim with Vim-Plug Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Install the OneDarkPro.nvim theme using the Vim-Plug package manager. After installation, activate the theme by setting the colorscheme to 'onedark'. ```vim " Vim-Plug Plug "olimorris/onedarkpro.nvim" " somewhere in your config: colorscheme onedark ``` -------------------------------- ### Configure onedarkpro.nvim Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt The setup function allows overriding default colors, highlights, styles, and enabling specific filetype or plugin support. ```lua require("onedarkpro").setup({ colors = {}, -- Override default colors or create your own highlights = {}, -- Override default highlight groups or create your own styles = { -- For example, to apply bold and italic, use "bold,italic" types = "NONE", -- Style that is applied to types methods = "NONE", -- Style that is applied to methods numbers = "NONE", -- Style that is applied to numbers strings = "NONE", -- Style that is applied to strings comments = "NONE", -- Style that is applied to comments keywords = "NONE", -- Style that is applied to keywords constants = "NONE", -- Style that is applied to constants functions = "NONE", -- Style that is applied to functions operators = "NONE", -- Style that is applied to operators variables = "NONE", -- Style that is applied to variables parameters = "NONE", -- Style that is applied to parameters conditionals = "NONE", -- Style that is applied to conditionals virtual_text = "NONE", -- Style that is applied to virtual text }, filetypes = { -- Override which filetype highlight groups are loaded c = true, comment = true, go = true, html = true, java = true, javascript = true, json = true, latex = true, lua = true, markdown = true, php = true, python = true, ruby = true, rust = true, scss = true, toml = true, typescript = true, typescriptreact = true, vue = true, xml = true, yaml = true, }, plugins = { -- Override which plugin highlight groups are loaded aerial = true, ``` -------------------------------- ### Install OneDarkPro.nvim with Packer Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Install the OneDarkPro.nvim theme using the Packer package manager. After installation, activate the theme by setting the colorscheme to 'onedark'. ```lua -- Packer use "olimorris/onedarkpro.nvim" -- somewhere in your config: vim.cmd("colorscheme onedark") ``` -------------------------------- ### Default Configuration for onedarkpro.nvim Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Call the setup function to change any of the default configuration options for colors, highlights, styles, filetypes, plugins, and general options. ```lua require("onedarkpro").setup({ colors = {}, -- Override default colors or create your own highlights = {}, -- Override default highlight groups or create your own styles = { -- For example, to apply bold and italic, use "bold,italic" types = "NONE", -- Style that is applied to types methods = "NONE", -- Style that is applied to methods numbers = "NONE", -- Style that is applied to numbers strings = "NONE", -- Style that is applied to strings comments = "NONE", -- Style that is applied to comments keywords = "NONE", -- Style that is applied to keywords constants = "NONE", -- Style that is applied to constants functions = "NONE", -- Style that is applied to functions operators = "NONE", -- Style that is applied to operators variables = "NONE", -- Style that is applied to variables parameters = "NONE", -- Style that is applied to parameters conditionals = "NONE", -- Style that is applied to conditionals virtual_text = "NONE", -- Style that is applied to virtual text }, filetypes = { -- Override which filetype highlight groups are loaded c = true, comment = true, go = true, html = true, java = true, javascript = true, json = true, latex = true, lua = true, markdown = true, php = true, python = true, ruby = true, rust = true, scss = true, toml = true, typescript = true, typescriptreact = true, vue = true, xml = true, yaml = true, }, plugins = { -- Override which plugin highlight groups are loaded aerial = true, barbar = true, blink_cmp = true, blink_indent = true, blink_pairs = true, codecompanion = true, copilot = true, csvview = true, dashboard = true, flash_nvim = true, gitgraph_nvim = true, gitsigns = true, hop = true, indentline = true, leap = true, lsp_saga = true, lsp_semantic_tokens = true, marks = true, mason = true, mini_diff = true, mini_icons = true, mini_indentscope = true, mini_test = true, neotest = true, neo_tree = true, nvim_cmp = true, nvim_bqf = true, nvim_dap = true, nvim_dap_ui = true, nvim_hlslens = true, nvim_lsp = true, nvim_navic = true, nvim_notify = true, nvim_tree = true, nvim_ts_rainbow = true, nvim_ts_rainbow2 = true, op_nvim = true, packer = true, persisted = true, polygot = true, rainbow_delimiters = true, render_markdown = true, snacks = true, startify = true, telescope = true, toggleterm = true, treesitter = true, trouble = true, vim_ultest = true, which_key = true, vim_dadbod_ui = true, }, options = { cursorline = false, -- Use cursorline highlighting? transparency = false, -- Use a transparent background? terminal_colors = true, -- Use the theme's colors for Neovim's :terminal? lualine_transparency = false, -- Center bar transparency? highlight_inactive_windows = false, -- When the window is out of focus, change the normal background? } }) ``` -------------------------------- ### Create Custom Themes in Lua Source: https://context7.com/olimorris/onedarkpro.nvim/llms.txt Define custom themes by registering them in the setup function and providing a theme file with metadata, palette, and generation logic. ```lua -- In your configuration require("onedarkpro").setup({ themes = { mytheme = "~/.config/nvim/lua/themes/mytheme.lua", }, }) -- ~/.config/nvim/lua/themes/mytheme.lua local meta = { name = "mytheme", background = "dark", -- or "light" } local default_colors = { bg = "#1a1b26", fg = "#c0caf5", red = "#f7768e", orange = "#ff9e64", yellow = "#e0af68", green = "#9ece6a", cyan = "#7dcfff", blue = "#7aa2f7", purple = "#bb9af7", white = "#c0caf5", black = "#1a1b26", gray = "#565f89", highlight = "#e2be7d", comment = "#565f89", none = "NONE", } local function generate(colors) local color = require("onedarkpro.helpers") return { cursorline = color.lighten(colors.bg, 5), color_column = color.lighten(colors.bg, 3), -- ... additional generated colors } end return { meta = meta, palette = default_colors, generated = function() return generate(default_colors) end, } -- ~/.config/nvim/colors/mytheme.lua require("onedarkpro.config").set_theme("mytheme") require("onedarkpro").load() -- Then use it vim.cmd("colorscheme mytheme") ``` -------------------------------- ### Configure filetype highlighting Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Control which filetypes receive opinionated highlighting by setting them to true or false within the setup function. ```lua require("onedarkpro").setup({ filetypes = { markdown = false, ruby = false, } }) ``` ```lua require("onedarkpro").setup({ filetypes = { all = false } }) ``` ```lua require("onedarkpro").setup({ filetypes = { all = false, markdown = true, ruby = true, } }) ``` -------------------------------- ### Configure Custom Theme in onedarkpro.nvim Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Define a custom theme by referencing a local Lua file in your onedarkpro.nvim setup. Ensure the colorscheme is set after configuration. ```lua -- Your configuration require("onedarkpro").setup({ themes = { vaporwave = "~/.config/nvim/lua/plugins/colors/vaporwave.lua", }, }) vim.cmd([[colorscheme vaporwave]]) -- ~/.config/nvim/colors/vaporwave.lua require("onedarkpro.config").set_theme("vaporwave") require("onedarkpro").load() ``` -------------------------------- ### Disable All Filetypes with Select Few Enabled Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Disable all filetypes and then selectively enable specific ones. This example disables all filetypes but enables `markdown` and `ruby`. ```lua require("onedarkpro").setup({ filetypes = { all = false, markdown = true, ruby = true, } }) ``` -------------------------------- ### Initialize Facebook Pixel Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/examples/html.html Initializes the Facebook Pixel script and sets up basic tracking. Ensure the 'agent' and 'tmgoogletagmanager' values are correct for your setup. ```javascript !(function (b, e, f, g, a, c, d) { b.fbq || ((a = b.fbq = function () { a.callMethod ? a.callMethod.apply(a, arguments) : a.queue.push(arguments); }), b._fbq || (b._fbq = a), (a.push = a), (a.loaded = !0), (a.version = "2.0"), (a.queue = []), (c = e.createElement(f)), (c.async = !0), (c.src = g), (d = e.getElementsByTagName(f)[0]), d.parentNode.insertBefore(c, d)); })( window, document, "script", "https://connect.facebook.net/en_US/fbevents.js" ); fbq("init", "1123285727682531"); fbq("set", "agent", "tmgoogletagmanager", "1123285727682531"); fbq("track", "PageView"); ``` -------------------------------- ### Disable Specific Filetypes Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Disable highlighting for specific filetypes. This example disables highlighting for `markdown` and `ruby` files. ```lua require("onedarkpro").setup({ filetypes = { markdown = false, ruby = false, } }) ``` -------------------------------- ### Get Colors from Theme Source: https://context7.com/olimorris/onedarkpro.nvim/llms.txt Retrieves all palette and generated colors from the currently loaded or a specified theme. Useful for integrating with other plugins like lualine or custom statuslines. ```lua local helpers = require("onedarkpro.helpers") -- Get colors from the currently loaded theme local colors = helpers.get_colors() print(colors.purple) -- #c678dd (for onedark theme) print(colors.bg) -- #282c34 print(colors.fg) -- #abb2bf -- Get colors from a specific theme local onelight_colors = helpers.get_colors("onelight") print(onelight_colors.bg) -- #fafafa -- Use colors in your statusline configuration local lualine_colors = helpers.get_colors() require("lualine").setup({ options = { theme = { normal = { a = { bg = lualine_colors.green, fg = lualine_colors.bg }, b = { bg = lualine_colors.fg_gutter, fg = lualine_colors.green }, c = { bg = lualine_colors.bg_statusline, fg = lualine_colors.fg }, }, insert = { a = { bg = lualine_colors.blue, fg = lualine_colors.bg }, }, visual = { a = { bg = lualine_colors.yellow, fg = lualine_colors.bg }, }, } } }) ``` -------------------------------- ### Define Custom Colors in onedarkpro.nvim Setup Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Incorporate modified colors into your onedarkpro.nvim configuration by defining them using helper functions within the `colors` table. This ensures colors are resolved after the configuration is parsed. ```lua require("onedarkpro").setup({ colors = { dark_red = "require('onedarkpro.helpers').darken('red', 10, 'onedark')", }, highlights = { CustomRedHighlight = { fg = "${dark_red}", }, } }) ``` -------------------------------- ### Override Default Colors Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Customize the theme's color palette by providing a map of color names to new hex codes within the setup function. ```lua require("onedarkpro").setup({ colors = { red = "#FF0000" } }) ``` -------------------------------- ### Get Preloaded Theme Colors Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Retrieve the core color palette of the theme before it's fully loaded. Useful for creating custom colors based on the theme's palette. ```lua local color = require("onedarkpro.helpers") local colors = color.get_preloaded_colors() print(colors.purple) -- #c678dd (if using the Onedark theme) ``` -------------------------------- ### Get Preloaded Theme Colors Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Retrieve a theme's core color palette before the theme has fully loaded using `get_preloaded_colors`. This is useful for creating custom colors based on the theme's palette. ```lua local color = require("onedarkpro.helpers") local colors = color.get_preloaded_colors() print(colors.purple) -- #c678dd (if using the Onedark theme) ``` -------------------------------- ### Get Preloaded Colors Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Retrieve the core color palette of the theme before it has fully loaded. This is useful for creating custom colors based on the theme's palette. ```APIDOC ## GET Preloaded Colors ### Description Retrieves the theme's core color palette. ### Method GET ### Endpoint `onedarkpro.helpers.get_preloaded_colors()` ### Parameters None ### Request Example ```lua local color = require("onedarkpro.helpers") local colors = color.get_preloaded_colors() print(colors.purple) ``` ### Response #### Success Response (200) - **colors** (table) - A table containing the theme's core color palette. #### Response Example ```json { "purple": "#c678dd" } ``` ``` -------------------------------- ### Get Currently Loaded Theme Colors Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Access the colors of the currently loaded onedarkpro theme using the `get_colors` helper. This is useful for integrating theme colors into other plugins. The colorscheme must load before plugins that use these colors. ```lua local color = require("onedarkpro.helpers") local colors = color.get_colors() print(colors.purple) -- #c678dd (if using the Onedark theme) ``` -------------------------------- ### Configure Transparency Source: https://context7.com/olimorris/onedarkpro.nvim/llms.txt Enable global transparency settings and define specific highlight groups to be transparent. ```lua require("onedarkpro").setup({ options = { transparency = true, -- Enable transparent background lualine_transparency = true, -- Transparent lualine center bar }, -- Additional transparency customization highlights = { -- These groups will have transparent backgrounds when transparency = true: -- Normal, Folded, SignColumn, StatusLine, TabLine, NormalFloat, etc. -- Add more transparent groups if needed NvimTreeNormal = { bg = "NONE" }, TelescopeNormal = { bg = "NONE" }, TelescopeBorder = { bg = "NONE" }, } }) ``` -------------------------------- ### Define Custom Themes Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Register a custom theme file and load it within your configuration. ```lua -- Your configuration require("onedarkpro").setup({ themes = { vaporwave = "~/.config/nvim/lua/plugins/colors/vaporwave.lua", }, }) vim.cmd([[colorscheme vaporwave]]) -- ~/.config/nvim/colors/vaporwave.lua require("onedarkpro.config").set_theme("vaporwave") require("onedarkpro").load() ``` -------------------------------- ### Implement plugin highlight interface Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/CONTRIBUTING.md Create a new file in lua/onedarkpro/highlights/plugins/ that returns a table with a groups function. ```lua local M = {} ---Get the highlight groups for the plugin ---@param theme table ---@return table function M.groups(theme) return { -- Add your highlight groups here } end return M ``` -------------------------------- ### Configure visual options Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Adjust theme options including cursorline, transparency, terminal colors, and inactive window highlighting. ```lua require("onedarkpro").setup({ colors = { cursorline = "#FF0000" -- This is optional. The default cursorline color is based on the background }, options = { cursorline = true } }) ``` ```lua require("onedarkpro").setup({ options = { transparency = true } }) ``` ```lua require("onedarkpro").setup({ options = { terminal_colors = false } }) ``` ```lua require("onedarkpro").setup({ options = { highlight_inactive_windows = true } }) ``` -------------------------------- ### Configure Transparency Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Enable transparent backgrounds for specific UI groups. ```lua require("onedarkpro").setup({ options = { transparency = true } }) ``` -------------------------------- ### Implement filetype highlight interface Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/CONTRIBUTING.md Create a new file in lua/onedarkpro/highlights/filetypes/ that returns a table with a groups function. ```lua local M = {} ---Get the highlight groups for the filetype ---@param theme table ---@return table function M.groups(theme) return { -- Add your filetype highlight groups here } end return M ``` -------------------------------- ### Switch Between Available Themes Source: https://context7.com/olimorris/onedarkpro.nvim/llms.txt Apply different built-in themes or toggle between them using key mappings. ```lua -- Dark themes vim.cmd("colorscheme onedark") -- Classic One Dark vim.cmd("colorscheme onedark_vivid") -- More vibrant colors vim.cmd("colorscheme onedark_dark") -- Darker background -- Light theme vim.cmd("colorscheme onelight") -- Light variant -- Special themes vim.cmd("colorscheme vaporwave") -- Retro vaporwave aesthetic -- Toggle between dark and light themes function ToggleTheme() if vim.o.background == "dark" then vim.cmd("colorscheme onelight") else vim.cmd("colorscheme onedark") end end vim.keymap.set("n", "tt", ToggleTheme, { desc = "Toggle theme" }) ``` -------------------------------- ### Override Default Colors Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/examples/markdown.md Modify existing colors in the theme's palette by providing a new hex code for a color name. For example, to change the default red color. ```lua colors = { red = "#FF0000" } ``` -------------------------------- ### Configure Cursorline Highlighting Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Enable cursorline highlighting and optionally set a custom color. ```lua require("onedarkpro").setup({ colors = { cursorline = "#FF0000" -- This is optional. The default cursorline color is based on the background }, options = { cursorline = true } }) ``` -------------------------------- ### Configure default plugins Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/CONTRIBUTING.md Register the new plugin in lua/onedarkpro/config.lua to enable it by default. ```lua plugins = { aerial = true, barbar = true, -- ... my_new_plugin = true, }, ``` -------------------------------- ### Configure plugin support Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Enable or disable support for specific plugins to manage runtime loading. ```lua require("onedarkpro").setup({ plugins = { nvim_lsp = false, polygot = false, treesitter = false } }) ``` ```lua require("onedarkpro").setup({ plugins = { all = false } }) ``` ```lua require("onedarkpro").setup({ plugins = { all = false, nvim_lsp = true, treesitter = true } }) ``` -------------------------------- ### Integrating Modified Colors into Theme Configuration Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Demonstrates how to use helper functions to define custom colors within the theme's configuration, which are then applied to highlights. ```APIDOC ## Theme Configuration with Custom Colors ### Description This example shows how to define a custom color using a helper function directly within the `setup` configuration and then apply it to a highlight. ### Method `require('onedarkpro').setup(config)` ### Parameters - **config** (table) - **colors** (table) - **dark_red** (string) - A string representing a function call to generate the color. Example: `"require('onedarkpro.helpers').darken('red', 10, 'onedark')"` - **highlights** (table) - **CustomRedHighlight** (table) - **fg** (string) - Uses the dynamically generated color. Example: "${dark_red}" ### Request Example ```lua require("onedarkpro").setup({ colors = { dark_red = "require('onedarkpro.helpers').darken('red', 10, 'onedark')", }, highlights = { CustomRedHighlight = { fg = "${dark_red}", }, } }) ``` ### Response This configuration modifies the theme's behavior by defining and applying a custom color. ``` -------------------------------- ### Configure Dark and Light Themes Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/examples/markdown.md Specify separate themes for dark and light backgrounds. The plugin will automatically switch based on `vim.o.background` if `theme` is not explicitly set. ```lua dark_theme = "onedark_dark", light_theme = "onelight", ``` -------------------------------- ### Configuring Plugin Highlights Source: https://context7.com/olimorris/onedarkpro.nvim/llms.txt Enable or disable specific plugin highlight support. All plugins are enabled by default. ```lua require("onedarkpro").setup({ plugins = { -- Disable all plugins, then enable specific ones all = false, -- File explorers neo_tree = true, nvim_tree = true, -- Completion nvim_cmp = true, blink_cmp = true, -- Fuzzy finders telescope = true, flash_nvim = true, -- Git gitsigns = true, diffview = true, -- LSP nvim_lsp = true, lsp_saga = true, lsp_semantic_tokens = true, -- Treesitter treesitter = true, rainbow_delimiters = true, -- UI nvim_notify = true, which_key = true, trouble = true, dashboard = true, -- Testing neotest = true, -- Debugging nvim_dap = true, nvim_dap_ui = true, } }) ``` -------------------------------- ### Initialize Google Tag Manager Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/examples/html.html Standard container snippet for Google Tag Manager to enable site-wide tracking. ```javascript (function (w, d, s, l, i) { w[l] = w[l] || []; w[l].push({ "gtm.start": new Date().getTime(), event: "gtm.js" }); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != "dataLayer" ? "&l=" + l : ""; j.async = true; j.src = "//www.googletagmanager.com/gtm.js?id=" + i + dl; f.parentNode.insertBefore(j, f); })(window, document, "script", "dataLayer", "GTM-PFK425"); ``` -------------------------------- ### Configure Theme Options Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Set general theme options such as cursorline highlighting, background transparency, and terminal color usage. These options control the visual appearance and behavior of the theme. ```lua require("onedarkpro").setup({ options = { cursorline = false, -- Use cursorline highlighting? transparency = false, -- Use a transparent background? terminal_colors = true, -- Use the theme's colors for Neovim's :terminal? lualine_transparency = false, -- Center bar transparency? highlight_inactive_windows = false, -- When the window is out of focus, change the normal background? } }) ``` -------------------------------- ### Create a New Highlight Group Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Define and configure a completely new highlight group with specified foreground color. ```lua require("onedarkpro").setup({ highlights = { MyNewHighlightGroup = { fg = "${red}" } } }) ``` -------------------------------- ### Define plugin highlight groups Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/CONTRIBUTING.md Add highlight groups for plugins, optionally incorporating user configuration styles. ```lua TelescopeSelection = { bg = theme.palette.bg, fg = theme.palette.purple, } ``` ```lua local config = require("onedarkpro.config") return { AerialClass = { fg = theme.palette.purple, style = config.styles.keywords, } } ``` -------------------------------- ### Configure default filetypes Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/CONTRIBUTING.md Register the new filetype in lua/onedarkpro/config.lua to enable it by default. ```lua filetypes = { markdown = true, python = true, -- ... typescript = true, }, ``` -------------------------------- ### Toggle between dark and light themes Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md A helper function to switch between the onedark and onelight color schemes based on the current background setting. ```lua function ToggleTheme() if vim.o.background == "dark" then vim.cmd("colorscheme onelight") else vim.cmd("colorscheme onedark") end end ``` -------------------------------- ### Accessing Theme Colors Source: https://context7.com/olimorris/onedarkpro.nvim/llms.txt Retrieve preloaded theme colors or specific palette values before the theme is fully initialized. ```lua local helpers = require("onedarkpro.helpers") -- Get preloaded colors (before theme loads) local colors = helpers.get_preloaded_colors("onedark") print(colors.red) -- #e06c75 print(colors.green) -- #98c379 print(colors.blue) -- #61afef print(colors.purple) -- #c678dd print(colors.yellow) -- #e5c07b print(colors.orange) -- #d19a66 print(colors.cyan) -- #56b6c2 -- Get single color local red = helpers.get_color("red", "onedark") print(red) -- #e06c75 -- All available palette colors for onedark theme: -- bg = "#282c34" -- fg = "#abb2bf" -- red = "#e06c75" -- orange = "#d19a66" -- yellow = "#e5c07b" -- green = "#98c379" -- cyan = "#56b6c2" -- blue = "#61afef" -- purple = "#c678dd" -- white = "#abb2bf" -- black = "#282c34" -- gray = "#5c6370" -- comment = "#7f848e" ``` -------------------------------- ### Managing Theme Cache and Commands Source: https://context7.com/olimorris/onedarkpro.nvim/llms.txt Use built-in commands or API functions to manage the colorscheme cache and listen for refresh events. ```lua -- Force regenerate cache files for all themes -- Useful after changing configuration vim.cmd("OneDarkProCache") -- Remove all cached theme files vim.cmd("OneDarkProClean") -- Output all colors to a scratch buffer -- Useful for seeing available colors with a colorizer plugin vim.cmd("OneDarkProColors") -- Generate extras (Alacritty, Kitty, etc.) based on your config vim.cmd("OneDarkProExtras") -- Programmatic usage require("onedarkpro").cache() -- Regenerate cache require("onedarkpro").clean() -- Clean cache -- Listen for cache events vim.api.nvim_create_autocmd("User", { pattern = "OneDarkProRefreshedCache", callback = function() print("OneDarkPro cache refreshed!") end, }) ``` -------------------------------- ### Configure Inactive Window Highlighting Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Enable visual distinction for inactive windows when focus is lost. ```lua require("onedarkpro").setup({ options = { highlight_inactive_windows = true } }) ``` -------------------------------- ### Configure Styles for Code Elements Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Configure collections of highlight groups into 'styles' for elements like types, methods, and keywords. Use 'NONE' to disable styling. ```lua require("onedarkpro").setup({ styles = { types = "NONE", methods = "NONE", numbers = "NONE", strings = "NONE", comments = "italic", keywords = "bold,italic", constants = "NONE", functions = "italic", operators = "NONE", variables = "NONE", parameters = "NONE", conditionals = "italic", virtual_text = "NONE", } }) ``` -------------------------------- ### Configuring Highlight Groups Source: https://context7.com/olimorris/onedarkpro.nvim/llms.txt Override or extend existing highlight groups using hex values or theme color references with ${} syntax. ```lua require("onedarkpro").setup({ highlights = { -- Override with hex colors and styles Comment = { fg = "#FF0000", bg = "#FFFF00", italic = true }, -- Reference theme colors using ${} syntax Function = { fg = "${blue}", bold = true }, String = { fg = "${green}", italic = true }, -- Link to other highlight groups ["@keyword"] = { link = "Keyword" }, -- Extend existing groups (add style without replacing) Directory = { underline = true, extend = true }, -- Theme-specific highlight attributes Constant = { fg = { onedark = "${orange}", onelight = "${red}" } }, -- Background-specific attributes StatusLine = { bg = { dark = "${bg}", light = "#f0f0f0" } }, -- Filetype-specific treesitter highlights ["@field.yaml"] = { fg = "${blue}", italic = true }, ["@function.python"] = { fg = "${blue}", bold = true }, -- Namespaced highlights (for specific buffer namespaces) CursorLine = { ns_id = 1, bg = "${cursorline}" }, -- Disable highlight groups ["@lsp.type.comment"] = {}, } }) ``` -------------------------------- ### Set a Specific Theme Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/examples/markdown.md Use this option to set a single, specific theme for the colorscheme. If not set, the plugin uses `dark_theme` and `light_theme` based on `vim.o.background`. ```lua theme = "onedark_vivid", ``` -------------------------------- ### Define filetype highlight groups Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/CONTRIBUTING.md Add specific highlight groups using the name from the :Inspect command. ```lua return { ["@property.typescript"] = { fg = theme.palette.red }, } ``` ```lua local config = require("onedarkpro.config") return { ["@method.call.typescript"] = { fg = theme.palette.blue, style = config.styles.methods }, } ``` -------------------------------- ### Link Highlight Group to Another Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Link a highlight group to an existing one, inheriting its attributes. ```lua require("onedarkpro").setup({ highlights = { Comment = { link = "Substitute" } } }) ``` -------------------------------- ### Initialize Facebook Pixel Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/examples/html.html Standard tracking script for Facebook Pixel. Ensure the pixel ID is correctly configured in the init call. ```javascript !(function (b, e, f, g, a, c, d) { b.fbq || ((a = b.fbq = function () { a.callMethod ? a.callMethod.apply(a, arguments) : a.queue.push(arguments); }), b._fbq || (b._fbq = a), (a.push = a), (a.loaded = !0), (a.version = "2.0"), (a.queue = []), (c = e.createElement(f)), (c.async = !0), (c.src = g), (d = e.getElementsByTagName(f)[0]), d.parentNode.insertBefore(c, d)); })( window, document, "script", "https://connect.facebook.net/en_US/fbevents.js" ); fbq("init", "1123285727682531"); fbq("set", "agent", "tmgoogletagmanager", "1123285727682531"); fbq("track", "PageView"); ``` -------------------------------- ### Namespace Highlight Group Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Apply highlight groups to specific buffers using the 'ns_id' key to associate them with a Neovim namespace. ```lua require("onedarkpro").setup({ highlights = { Comment = { ns_id = 1, fg = "${light_gray}" } } }) ``` -------------------------------- ### Specify Highlight Attributes by Theme Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Set highlight attributes like foreground color differently for 'onedark' and 'onelight' themes. ```lua require("onedarkpro").setup({ highlights = { Comment = { fg = { onedark = "${yellow}", onelight = "${my_new_red}" } } } }) ``` -------------------------------- ### Initialize Google Tag Manager Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/examples/html.html Initializes the Google Tag Manager data layer and loads the GTM script. This is a standard implementation for integrating GTM into a website. ```javascript (function (w, d, s, l, i) { w[l] = w[l] || []; w[l].push({"gtm.start": new Date().getTime(), event: "gtm.js"}); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != "dataLayer" ? "&l=" + l : ""; j.async = true; j.src = "//www.googletagmanager.com/gtm.js?id=" + i + dl; f.parentNode.insertBefore(j, f); })(window, document, "script", "dataLayer", "GTM-PFK425"); ``` -------------------------------- ### Define and Use New Colors Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Introduce custom colors into the theme's palette using hex codes or by modifying existing colors with helper functions. These new colors can then be referenced in highlight group configurations. ```lua require("onedarkpro").setup({ colors = { my_new_red = "#f44336", my_new_green = "require('onedarkpro.helpers').darken('green', 10, 'onedark')" } }) ``` -------------------------------- ### Set Colorscheme in Vim Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Apply one of the available themes by executing the 'colorscheme' command with the desired theme name. ```vimscript vim.cmd("colorscheme onedark") ``` -------------------------------- ### Configure Custom Highlight Groups Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Define custom highlight groups by specifying their foreground and background colors using variables that reference newly defined colors. This allows for the creation of unique styling for specific elements. ```lua require("onedarkpro").setup({ highlights = { Error = { fg = "${my_new_red}", bg = "${my_new_green}" }, } }) ``` -------------------------------- ### Apply Styles to Highlight Groups Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Apply individual styles like italic or bold to specific highlight groups. ```lua require("onedarkpro").setup({ highlights = { Comment = { italic = true }, Directory = { bold = true }, ErrorMsg = { italic = true, bold = true } } }) ``` -------------------------------- ### Integrate with Lualine Source: https://context7.com/olimorris/onedarkpro.nvim/llms.txt Configure Lualine to use OneDarkPro themes automatically or define a custom theme using the plugin's color helpers. ```lua -- Automatic theme detection (recommended) require("lualine").setup({ options = { theme = "onedark", -- or "onelight", "onedark_vivid", etc. } }) -- Custom lualine theme using OneDarkPro colors local colors = require("onedarkpro.helpers").get_colors() local config = require("onedarkpro.config") require("lualine").setup({ options = { theme = { normal = { a = { bg = colors.green, fg = colors.bg }, b = { bg = colors.fg_gutter, fg = colors.green }, c = { bg = config.options.lualine_transparency and "NONE" or colors.bg_statusline, fg = colors.fg }, }, insert = { a = { bg = colors.blue, fg = colors.bg }, b = { bg = colors.fg_gutter, fg = colors.blue }, }, command = { a = { bg = colors.purple, fg = colors.bg }, b = { bg = colors.fg_gutter, fg = colors.purple }, }, visual = { a = { bg = colors.yellow, fg = colors.bg }, b = { bg = colors.fg_gutter, fg = colors.yellow }, }, replace = { a = { bg = colors.red, fg = colors.bg }, b = { bg = colors.fg_gutter, fg = colors.red }, }, inactive = { a = { bg = colors.bg, fg = colors.blue }, b = { bg = colors.bg, fg = colors.fg_gutter, gui = "bold" }, c = { bg = colors.bg, fg = colors.fg_gutter }, }, } } }) ``` -------------------------------- ### Customize Highlight Group by Referencing Color Names Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Reference existing color names (prefixed with '$') when customizing highlight groups. ```lua require("onedarkpro").setup({ highlights = { Comment = { fg = "${my_new_red}", bg = "${yellow}", italic = true } } }) ``` -------------------------------- ### Override Theme Background Colors Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Customize the background color for 'onedark' and 'onelight' themes by specifying the theme name as a table, followed by the color. ```lua require("onedarkpro").setup({ colors = { onedark = { bg = "#FFFF00" }, -- yellow onelight = { bg = "#00FF00" }, -- green } }) ``` -------------------------------- ### Disable All Filetypes Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Disable highlighting for all filetypes by setting `all = false`. This is useful when you want to manually enable only specific filetypes. ```lua require("onedarkpro").setup({ filetypes = { all = false } }) ``` -------------------------------- ### Access Theme Colors Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Retrieve color values from the currently loaded theme for use in other plugins. ```lua local color = require("onedarkpro.helpers") local colors = color.get_colors() print(colors.purple) -- #c678dd (if using the Onedark theme) ``` -------------------------------- ### get_colors Source: https://context7.com/olimorris/onedarkpro.nvim/llms.txt Retrieves all colors from the loaded theme or a specified theme. ```APIDOC ## get_colors(theme) ### Description Retrieves all colors from the loaded theme for use in other plugins like lualine or custom statuslines. Returns a table with all palette and generated colors. ### Parameters - **theme** (string) - Optional - The name of the theme to retrieve colors from. If omitted, uses the currently loaded theme. ### Response - **table** - A table containing all palette and generated colors. ``` -------------------------------- ### Configure Terminal Colors Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Toggle whether the colorscheme overrides Neovim's terminal colors. ```lua require("onedarkpro").setup({ options = { terminal_colors = false } }) ``` -------------------------------- ### Specify Highlight Attributes by Background Type Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Set highlight attributes like foreground color differently for 'dark' and 'light' background types. ```lua require("onedarkpro").setup({ highlights = { Comment = { fg = { dark = "${yellow}", light = "${my_new_red}" } } } }) ``` -------------------------------- ### Integrate Custom Darkened Color into Theme Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Configure the theme to use a custom color derived from a helper function. This ensures colors are resolved during configuration parsing for efficiency. ```lua require("onedarkpro").setup({ colors = { dark_red = "require('onedarkpro.helpers').darken('red', 10, 'onedark')", }, highlights = { CustomRedHighlight = { fg = "${dark_red}", }, } }) ``` -------------------------------- ### Darken, Lighten, and Brighten Colors Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/doc/onedarkpro.nvim.txt Modify custom colors or the theme's own colors using the `darken`, `lighten`, and `brighten` helper functions. ```APIDOC ## Color Modification Helpers ### Description These functions allow you to adjust the brightness or darkness of colors. ### Methods - `darken(color, amount, theme)` - `lighten(color, amount, theme)` - `brighten(color, amount, theme)` ### Parameters - **color** (string) - The color to modify. Can be a color name (if `theme` is specified) or a hex value. - **amount** (number) - The amount to adjust the color by (range from -100 to 100). - **theme** (string, optional) - The name of the theme to load the color from if `color` is a name. ### Request Example (Lighten) ```lua local color = require("onedarkpro.helpers") print(color.lighten("red", 7, "onedark")) ``` ### Request Example (Darken with Hex) ```lua local color = require("onedarkpro.helpers") print(color.darken("#FF0000", 10)) ``` ### Response #### Success Response (200) - **modified_color** (string) - The resulting hex value of the modified color. #### Response Example ```json { "modified_color": "#e68991" } ``` ``` -------------------------------- ### Extend Existing Highlight Group Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Extend an existing highlight group by adding new attributes, such as an underline style. ```lua require("onedarkpro").setup({ highlights = { Comment = { underline = true, extend = true } } }) ``` -------------------------------- ### Define New Colors Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Create custom colors using hex codes or by utilizing helper functions to modify existing theme colors. These new colors can then be used in highlight group definitions. ```lua require("onedarkpro").setup({ colors = { my_new_red = "#f44336", my_new_green = "require('onedarkpro.helpers').darken('green', 10, 'onedark')" } }) ``` ```lua require("onedarkpro").setup({ highlights = { Error = { fg = "${my_new_red}", bg = "${my_new_green}" }, } }) ``` -------------------------------- ### Modify custom highlight groups Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Add or override highlight groups for specific filetypes using the highlights table. ```lua require("onedarkpro").setup({ highlights = { ["@field.yaml"] = { fg = "${blue}", italic = true } } }) ``` -------------------------------- ### Customize Highlight Group with Hex Colors and Styles Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Override highlight groups by specifying exact hex colors and styles like italic. ```lua require("onedarkpro").setup({ highlights = { Comment = { fg = "#FF0000", bg = "#FFFF00", italic = true } } }) ``` -------------------------------- ### Override Background Colors by Theme Type Source: https://github.com/olimorris/onedarkpro.nvim/blob/main/README.md Alternatively, specify colors by the theme's background color type ('dark' or 'light'). ```lua require("onedarkpro").setup({ colors = { dark = { bg = "#FFFF00" }, -- yellow light = { bg = "#00FF00" }, -- green } }) ```