diff options
author | rxi <rxi@users.noreply.github.com> | 2020-04-26 11:00:29 +0100 |
---|---|---|
committer | rxi <rxi@users.noreply.github.com> | 2020-04-26 11:00:29 +0100 |
commit | 8cb8e921d5ddd2b728029685b93b1e72157a69f5 (patch) | |
tree | e321b50cfdaa022caecd3db3fba46cf087269d5b | |
download | lite-xl-colors-8cb8e921d5ddd2b728029685b93b1e72157a69f5.tar.gz lite-xl-colors-8cb8e921d5ddd2b728029685b93b1e72157a69f5.zip |
Initial commit
-rw-r--r-- | README.md | 22 | ||||
-rw-r--r-- | colors/monodark.lua | 29 | ||||
-rw-r--r-- | colors/winter.lua | 28 | ||||
-rwxr-xr-x | make_preview_image.lua | 61 |
4 files changed, 140 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..90892d6 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +Color themes for the [lite text editor](https://github.com/rxi/lite) + +*Note: if you make a pull request, the relevant table should be updated and kept +in alphabetical order. The [`make_preview_image.lua`](make_preview_image.lua) +script should be used to create a preview image for your theme which should be +embedded in the table.* + +--- + +## Dark + +Theme | Preview +------|----------------------------------------- +[`monodark`](colors/monodark.lua?raw=1) | ![monodark_preview](https://user-images.githubusercontent.com/3920290/80304201-62353400-87ac-11ea-9b13-9ca1b9db0f99.png) +[`winter`](colors/winter.lua?raw=1) |![winter_preview](https://user-images.githubusercontent.com/3920290/80304194-5c3f5300-87ac-11ea-9acf-33892579093e.png) + + +## Light + +Theme | Preview +------|----------------------------------------- +--- | --- diff --git a/colors/monodark.lua b/colors/monodark.lua new file mode 100644 index 0000000..a61f566 --- /dev/null +++ b/colors/monodark.lua @@ -0,0 +1,29 @@ +local style = require "core.style" +local common = require "core.common" + +style.background = { common.color "#080808" } +style.background2 = { common.color "#080808" } +style.background3 = { common.color "#101010" } +style.text = { common.color "#707070" } +style.caret = { common.color "#ffffff" } +style.accent = { common.color "#d0d0d0" } +style.dim = { common.color "#303030" } +style.divider = { common.color "#080808" } +style.selection = { common.color "#242424" } +style.line_number = { common.color "#202020" } +style.line_number2 = { common.color "#707070" } +style.line_highlight = { common.color "#101010" } +style.scrollbar = { common.color "#252525" } +style.scrollbar2 = { common.color "#303030" } + +style.syntax = {} +style.syntax["normal"] = { common.color "#a0a0a0" } +style.syntax["symbol"] = { common.color "#a0a0a0" } +style.syntax["comment"] = { common.color "#404040" } +style.syntax["keyword"] = { common.color "#f0f0f0" } +style.syntax["keyword2"] = { common.color "#f0f0f0" } +style.syntax["number"] = { common.color "#f0f0f0" } +style.syntax["literal"] = { common.color "#f0f0f0" } +style.syntax["string"] = { common.color "#f0f0f0" } +style.syntax["operator"] = { common.color "#f0f0f0" } +style.syntax["function"] = { common.color "#a0a0a0" } diff --git a/colors/winter.lua b/colors/winter.lua new file mode 100644 index 0000000..35fb408 --- /dev/null +++ b/colors/winter.lua @@ -0,0 +1,28 @@ +local style = require "core.style" +local common = require "core.common" + +style.background = { common.color "#282a36" } +style.background2 = { common.color "#22242e" } +style.background3 = { common.color "#22242e" } +style.text = { common.color "#aab3e6" } +style.caret = { common.color "#f5faff" } +style.accent = { common.color "#ffb86c" } +style.dim = { common.color "#4f526b" } +style.divider = { common.color "#22242e" } +style.selection = { common.color "#4c5163" } +style.line_number = { common.color "#44475a" } +style.line_number2 = { common.color "#717796" } +style.line_highlight = { common.color "#2d303d" } +style.scrollbar = { common.color "#44475a" } +style.scrollbar2 = { common.color "#4c5163" } + +style.syntax["normal"] = { common.color "#f5faff" } +style.syntax["symbol"] = { common.color "#f5faff" } +style.syntax["comment"] = { common.color "#6272a4" } +style.syntax["keyword"] = { common.color "#ff79c6" } +style.syntax["keyword2"] = { common.color "#8be9fd" } +style.syntax["number"] = { common.color "#bd93f9" } +style.syntax["literal"] = { common.color "#bd93f9" } +style.syntax["string"] = { common.color "#f1fa8c" } +style.syntax["operator"] = { common.color "#ff79c6" } +style.syntax["function"] = { common.color "#8be9fd" } diff --git a/make_preview_image.lua b/make_preview_image.lua new file mode 100755 index 0000000..31f088d --- /dev/null +++ b/make_preview_image.lua @@ -0,0 +1,61 @@ +#!/usr/bin/lua + +local filename = ... +local name = filename:match("([^\\/]+)%..*$") .. "_preview" + + +-- get colors +local text = io.open(filename):read("*a") +local colors = {} +for r, g, b in text:gmatch("#(%x%x)(%x%x)(%x%x)") do + r = tonumber(r, 16) + g = tonumber(g, 16) + b = tonumber(b, 16) + table.insert(colors, { r, g, b }) +end + +table.sort(colors, function(a, b) + return a[1] + a[2] + a[3] < b[1] + b[2] + b[3] +end) + +local function eq(a, b) + return a[1] == b[1] and a[2] == b[2] and a[3] == b[3] +end + +local prev = {} +for i = #colors, 1, -1 do + if eq(colors[i], prev) then + table.remove(colors, i) + else + prev = colors[i] + end +end + + +-- generate ppm file +local w = 200 +local h = 16 +local fp = io.open(name .. ".ppm", "wb") +fp:write("P3\n") +fp:write(w, " ", h, "\n") +fp:write("255\n") + +local row = {} +for i = 0, w - 1 do + local idx = math.floor((#colors / w) * i) + 1 + local r, g, b = table.unpack(colors[idx]) + table.insert(row, r) + table.insert(row, g) + table.insert(row, b) +end +row = table.concat(row, " ") .. "\n" + +for i = 1, h do + fp:write(row) +end +fp:close() + + +-- convert ppm file to png +os.execute(string.format("convert %s.ppm %s.png", name, name)) +os.execute(string.format("rm %s.ppm", name)) |