brenoprata10 / nvim-highlight-colors

Highlight colors for neovim
724 stars 33 forks source link

Feature request: Function to get the current toggle state #129

Open Mange opened 2 weeks ago

Mange commented 2 weeks ago

It would be great to have a function like enabled(): boolean that I can use to check the current status of this plugin.

local nhc = require("nvim-highlight-colors")
nhc.enabled() -- true

nhc.turnOff()
nhc.enabled() -- false

nhc.toggle()
nhc.enabled() -- true

nhc.turnOn()
nhc.enabled() -- true
brenoprata10 commented 2 weeks ago

We do have this: https://github.com/brenoprata10/nvim-highlight-colors/blob/e967e2ba13fd4ca731b41d0e5cc1ac2edcd6e25e/lua/nvim-highlight-colors/init.lua#L11 Maybe you can use it

Mange commented 1 week ago

vim.g.loaded_nvim_highlight_colors

Thanks, I noticed that one but wasn't sure if I wanted to rely on it or not since it appears to be an internal undocumented state variable.

It's part of why I want an official public API for it, so I don't have to think much about it. :-)