-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(platforms): add generation for platform files
This is based heavily off of the tokyonight extras-generation system. Co-authored-by: Owen Friedman <[email protected]>
- Loading branch information
Showing
12 changed files
with
152 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
local U = require('nordic.utils') | ||
|
||
local M = {} | ||
|
||
--- @param colors ColorScheme | ||
function M.generate(colors) | ||
local footColors = U.removeHash(colors) | ||
|
||
local foot = U.template( | ||
[[ | ||
[colors] | ||
foreground=${white1} | ||
background=${bg} | ||
regular0=${gray2} | ||
regular1=${red.base} | ||
regular2=${green.base} | ||
regular3=${yellow.base} | ||
regular4=${blue1} | ||
regular5=${magenta.base} | ||
regular6=${cyan.base} | ||
regular7=${white1} | ||
bright0=${gray3} | ||
bright1=${red.bright} | ||
bright2=${green.bright} | ||
bright3=${yellow.bright} | ||
bright4=${blue2} | ||
bright5=${magenta.bright} | ||
bright6=${cyan.bright} | ||
bright7=${white2} | ||
]], | ||
footColors | ||
) | ||
|
||
return foot | ||
end | ||
|
||
return M |
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,38 @@ | ||
-- Adapted from [tokyonight](https://github.com/folke/tokyonight.nvim) | ||
-- | ||
-- Tokyonight is licensed under [Apache License 2.0](https://raw.githubusercontent.com/folke/tokyonight.nvim/refs/heads/main/LICENSE) | ||
-- | ||
-- Changes: | ||
-- - Adjusted the format of M.platforms | ||
-- - Changed variable names (mostly from extra -> platform) | ||
-- - Simplified code to work better for just one color scheme "flavor" | ||
-- - Move `write` function to `utils.lua` | ||
local U = require('nordic.utils') | ||
|
||
local M = {} | ||
|
||
--- @type table<string, {ext?: string, url:string, subdir?: string}> | ||
-- stylua: ignore | ||
M.platforms = { | ||
foot = { ext = "ini", url = "https://codeberg.org/dnkl/foot" }, | ||
} | ||
|
||
function M.setup() | ||
local C = require('nordic.colors') | ||
|
||
---@type string[] | ||
local platform_names = vim.tbl_keys(M.platforms) | ||
table.sort(platform_names) | ||
|
||
for _, platform in ipairs(platform_names) do | ||
local info = M.platforms[platform] | ||
local plugin = require('nordic.platforms.' .. platform) | ||
local fname = platform .. (info.subdir and '/' .. info.subdir .. '/' or '') .. '/nordic' .. '.' .. info.ext | ||
fname = string.gsub(fname, '%.$', '') -- remove trailing dot when no extension | ||
|
||
print('[write] ' .. fname) | ||
U.write('platforms/' .. fname, plugin.generate(C)) | ||
end | ||
end | ||
|
||
return M |
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
File renamed without changes.
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,23 @@ | ||
# Nordic Colorscheme for foot. | ||
# Based on https://github.com/AlexvZyl/nordic.nvim | ||
# Author: @filahf | ||
|
||
[colors] | ||
foreground=D8DEE9 | ||
background=242933 | ||
regular0=3B4252 | ||
regular1=BF616A | ||
regular2=A3BE8C | ||
regular3=EBCB8B | ||
regular4=81A1C1 | ||
regular5=B48EAD | ||
regular6=8FBCBB | ||
regular7=D8DEE9 | ||
bright0=3B4252 | ||
bright1=D06F79 | ||
bright2=B1D196 | ||
bright3=F0D399 | ||
bright4=88C0D0 | ||
bright5=C895BF | ||
bright6=93CCDC | ||
bright7=E5E9F0 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,3 @@ | ||
#!/usr/bin/env sh | ||
|
||
nvim --headless -u NONE -c "lua package.path = package.path .. ';./lua/?/init.lua;./lua/?.lua'; require('nordic.platforms').setup() ; vim.api.nvim_command('quit')" |
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