forked from letoram/durden
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stand-alone color import helper + more schemes
This just takes the json output from https://terminal.sexy
- Loading branch information
Showing
12 changed files
with
673 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-- scheme: | ||
-- by: | ||
return { | ||
{88, 110, 117}, | ||
{}, -- secondary | ||
{253, 246, 227}, | ||
{88, 110, 227, 253, 246, 227}, | ||
{88, 110, 117}, | ||
{}, -- alt-cursor | ||
{}, -- highlight | ||
{}, -- label | ||
{}, -- warning | ||
{}, -- error | ||
{}, -- alert | ||
{}, -- reference | ||
{}, -- inactive | ||
{}, -- ui | ||
{0, 43, 54}, | ||
{220, 50, 47}, | ||
{133, 153, 0}, | ||
{181, 137, 0}, | ||
{38, 139, 210}, | ||
{108, 113, 196}, | ||
{42, 161, 152}, | ||
{147, 161, 161}, | ||
{101, 123, 131}, | ||
{220, 50, 47}, | ||
{133, 153, 0}, | ||
{181, 137, 0}, | ||
{38, 139, 210}, | ||
{108, 113, 196}, | ||
{42, 161, 152}, | ||
{253, 246, 227}, | ||
{88, 110, 117}, | ||
{253, 246, 227}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-- scheme: | ||
-- by: | ||
return { | ||
{147, 161, 161}, | ||
{}, -- secondary | ||
{0, 43, 54}, | ||
{147, 161, 54, 0, 43, 54}, | ||
{147, 161, 161}, | ||
{}, -- alt-cursor | ||
{}, -- highlight | ||
{}, -- label | ||
{}, -- warning | ||
{}, -- error | ||
{}, -- alert | ||
{}, -- reference | ||
{}, -- inactive | ||
{}, -- ui | ||
{0, 43, 54}, | ||
{220, 50, 47}, | ||
{133, 153, 0}, | ||
{181, 137, 0}, | ||
{38, 139, 210}, | ||
{108, 113, 196}, | ||
{42, 161, 152}, | ||
{147, 161, 161}, | ||
{101, 123, 131}, | ||
{220, 50, 47}, | ||
{133, 153, 0}, | ||
{181, 137, 0}, | ||
{38, 139, 210}, | ||
{108, 113, 196}, | ||
{42, 161, 152}, | ||
{253, 246, 227}, | ||
{147, 161, 161}, | ||
{0, 43, 54}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
return { | ||
{252, 232, 195}, | ||
{}, -- secondary | ||
{28, 27, 25}, | ||
{252, 232, 25, 28, 27, 25}, | ||
{251, 184, 41}, | ||
{4, 71, 214}, | ||
{}, -- highlight | ||
{}, -- label | ||
{}, -- warning | ||
{}, -- error | ||
{}, -- alert | ||
{}, -- reference | ||
{}, -- inactive | ||
{}, -- ui | ||
{28, 27, 25}, | ||
{239, 47, 39}, | ||
{81, 159, 80}, | ||
{251, 184, 41}, | ||
{44, 120, 191}, | ||
{224, 44, 109}, | ||
{10, 174, 179}, | ||
{208, 191, 161}, | ||
{145, 129, 117}, | ||
{247, 83, 65}, | ||
{152, 188, 55}, | ||
{254, 208, 110}, | ||
{104, 168, 228}, | ||
{255, 92, 143}, | ||
{83, 253, 233}, | ||
{252, 232, 195}, | ||
{252, 232, 195}, | ||
{28, 27, 25}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
return { | ||
{167, 167, 167}, | ||
{30, 30, 30}, | ||
{}, -- background | ||
{167, 167, 30, 30, 30, 30}, | ||
{}, -- cursor | ||
{}, -- alt-cursor | ||
{}, -- highlight | ||
{}, -- label | ||
{}, -- warning | ||
{}, -- error | ||
{}, -- alert | ||
{}, -- reference | ||
{}, -- inactive | ||
{}, -- ui | ||
{30, 30, 30}, | ||
{207, 106, 76}, | ||
{143, 157, 106}, | ||
{249, 238, 152}, | ||
{117, 135, 166}, | ||
{155, 133, 157}, | ||
{175, 196, 219}, | ||
{167, 167, 167}, | ||
{95, 90, 96}, | ||
{207, 106, 76}, | ||
{143, 157, 106}, | ||
{249, 238, 152}, | ||
{117, 135, 166}, | ||
{155, 133, 157}, | ||
{175, 196, 219}, | ||
{255, 255, 255}, | ||
{167, 167, 167}, | ||
{30, 30, 30}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
-- This is a simple stand-alone script for converting json export output | ||
-- from https://terminal.sexy into color-schemes that can be used as part | ||
-- of target/video/color/schemes and global/settings/visual/colors/... | ||
|
||
local json = dofile('./json.lua') | ||
|
||
if not arg[1] or not arg[2] then | ||
error("use: color-in.json color-out.lua") | ||
end | ||
|
||
file = io.open(arg[1]) | ||
|
||
local inp = file:read("*all") | ||
local res = json.decode(inp) | ||
|
||
local rt = | ||
{ | ||
"{}, -- primary", | ||
"{}, -- secondary", | ||
"{}, -- background", | ||
"{}, -- text", | ||
"{}, -- cursor", | ||
"{}, -- alt-cursor", | ||
"{}, -- highlight", | ||
"{}, -- label", | ||
"{}, -- warning", | ||
"{}, -- error", | ||
"{}, -- alert", | ||
"{}, -- reference", | ||
"{}, -- inactive", | ||
"{}, -- ui" | ||
} | ||
|
||
local term_i = 15 | ||
local function getcol(v) | ||
local r = string.sub(v, 2, 3) | ||
local g = string.sub(v, 4, 5) | ||
local b = string.sub(v, 6, 7) | ||
return { | ||
tonumber(r, 16), | ||
tonumber(g, 16), | ||
tonumber(b, 16) | ||
} | ||
end | ||
|
||
-- 1..16 + foreground and background | ||
for k,v in pairs(res.color) do | ||
local col = getcol(v) | ||
table.insert(rt, string.format("{%d, %d, %d},", col[1], col[2], col[3])) | ||
end | ||
|
||
if res.foreground then | ||
local col = getcol(res.foreground) | ||
table.insert(rt, string.format("{%d, %d, %d},", col[1], col[2], col[3])) | ||
rt[1] = rt[#rt] | ||
|
||
if res.background then | ||
local col2 = getcol(res.background) | ||
table.insert(rt, string.format("{%d, %d, %d},", col2[1], col2[2], col2[3])) | ||
rt[3] = rt[#rt] | ||
rt[4] = string.format("{%d, %d, %d, %d, %d, %d},", | ||
col[1], col[2], col2[3], col2[1], col2[2], col2[3]) | ||
end | ||
end | ||
|
||
if res.cursor then | ||
local col = getcol(res.cursor) | ||
rt[5] = string.format("{%d, %d, %d},", col[1], col[2], col[3]) | ||
rt[6] = string.format("{%d, %d, %d},", 255 - col[1], 255 - col[2], 255 - col[3]) | ||
else | ||
rt[5] = rt[1] | ||
end | ||
|
||
-- auto-assign into labeled slots is worse, some base assumptions might be possible, | ||
-- e.g. error tends to be terminal | ||
-- | ||
-- 'red', warning terminal 'yellow', inactive 'dark-grey' and sanity check against | ||
-- fg/bg values. but might as well do this somewhere else | ||
-- | ||
-- label (8), warning (9), error (10), alert (11), ref (12), inactive (13), ui (14) | ||
-- | ||
local out = io.output(arg[2]) | ||
|
||
if res.name then | ||
out:write("-- scheme: " .. res.name .. "\n") | ||
end | ||
|
||
if res.author then | ||
out:write("-- by: " .. res.author .. "\n") | ||
end | ||
|
||
out:write("return {\n") | ||
|
||
for _,v in ipairs(rt) do | ||
out:write(v .. "\n") | ||
end | ||
|
||
out:write("}") | ||
out:close() |
Oops, something went wrong.