neanias / everforest-nvim

A Lua port of the Everforest colour scheme
233 stars 15 forks source link

Get palette colors #12

Open ryanmsnyder opened 12 months ago

ryanmsnyder commented 12 months ago

Is there a function to easily get the current palette's colors? For example, with catppuccin, there's the get_palette function:

local flavor = vim.g.catppuccin_flavour
local C = require("catppuccin.palettes").get_palette(flavor)

And then you can easily retrieve a color's hex value:

local green = C.green
neanias commented 11 months ago

Hi there, apologies for the delay. It's a bit of a roundabout process, but this could work:

local everforest = require("everforest")
local colours = require("everforest.colours")

-- Instead of `everforest.config`, you can add in your own config here by using
-- `everforest.setup({ show_eob = false)` before you generate the palette.
local palette = colours.generate_palette(everforest.config, vim.o.background)
local green = palette.green