Skip to content

Exporting color palette and lush spec in a single lua table #86

Answered by rktjmp
MurdeRM3L0DY asked this question in Q&A
Discussion options

You must be logged in to vote

The lush spec itself is a table, so you should be able to do something like

local colorscheme = require("my-lush-theme")
-- then either access the color, convert it to a string or get the hex value directly
local bg = colorscheme.Normal.bg
bg.darken(10) -- can still apply operators
bg.h -- or access h,s,l, anything values
local bg_hex = colorscheme.Normal.bg.hex -- get as hex string
local str = tostring(colorscheme.Normal.bg) -- anything tostring'ing will convert to hex automatically
local rgb = colorscheme.Normal.bg.rgb -- {r, g, b} table (just added, so you may need to git pull)

If you want to store a normal table (or any other data), you can use the lush key which is retained in the spec:

Replies: 3 comments 10 replies

Comment options

You must be logged in to vote
2 replies
@MurdeRM3L0DY
Comment options

@MurdeRM3L0DY
Comment options

Answer selected by MurdeRM3L0DY
Comment options

You must be logged in to vote
2 replies
@rktjmp
Comment options

@MurdeRM3L0DY
Comment options

Comment options

You must be logged in to vote
6 replies
@rktjmp
Comment options

@MurdeRM3L0DY
Comment options

@rktjmp
Comment options

@MurdeRM3L0DY
Comment options

@rktjmp
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants