Giter Club home page Giter Club logo

nvim-highlight-colors's Introduction

nvim-highlight-colors

Highlight colors within Neovim

Background highlights for hex, rgb, hsl, named colors, and CSS variables

Features

  • Realtime color highlighting
  • Supports hex, rgb, hsl, CSS variables, and Tailwind CSS
  • Multiple rendering modes: background, foreground, and virtual text

Usage

Install via your preferred package manager:

'brenoprata10/nvim-highlight-colors'

Initialize the plugin:

-- Ensure termguicolors is enabled if not already
vim.opt.termguicolors = true

require('nvim-highlight-colors').setup({})

Options

require("nvim-highlight-colors").setup {
	---Render style
	---@usage 'background'|'foreground'|'virtual'
	render = 'background',

	---Set virtual symbol (requires render to be set to 'virtual')
	virtual_symbol = 'โ– ',

	---Highlight named colors, e.g. 'green'
	enable_named_colors = true,

	---Highlight tailwind colors, e.g. 'bg-blue-500'
	enable_tailwind = false,

    ---Highlight custom tailwind colors, e.g. 'bg-your-color-200'
    enable_document_color = false, -- / true

	---Set custom colors
	---Label must be properly escaped with '%' to adhere to `string.gmatch`
	--- :help string.gmatch
	custom_colors = {
		{ label = '%-%-theme%-primary%-color', color = '#0f1219' },
		{ label = '%-%-theme%-secondary%-color', color = '#5a5d64' },
	}
}

Render modes

Examples shown use enable_tailwind = true

Background

Background highlights for named colors, CSS variables, and Tailwind CSS colors

Foreground

Foreground highlights for named colors, CSS variables, and Tailwind CSS colors

Virtual text

Virtual text highlights for named colors, CSS variables, and Tailwind CSS colors

Commands

Command Description
:HighlightColors On Turn highlights on
:HighlightColors Off Turn highlights off
:HighlightColors Toggle Toggle highlights

Commands are also available in lua:

require("nvim-highlight-colors").turnOn()
require("nvim-highlight-colors").turnOff()
require("nvim-highlight-colors").toggle()

nvim-highlight-colors's People

Contributors

brenoprata10 avatar sin1111yi avatar nickytope avatar mvllow avatar akmadan23 avatar cpea2506 avatar zoclhas avatar mg979 avatar zax-xyz avatar 4rgc avatar brenoprata avatar gsuuon avatar genzj avatar nebulaw avatar

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

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

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

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

  • D3 photo D3

    Data-Driven Documents codes.