Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.tests/
.envrc
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ Heres the default config table
-- }
-- },
-- remaps.highlights = {
-- rose_pine = {
-- base = {
-- rose_pine = function(cp) -- cp is theme color palette
-- return { base = {
-- Normal = { bg = "#000000" }
-- },
-- }, }
-- }
-- },
--
Expand All @@ -199,6 +199,12 @@ Heres the default config table
telescope = true,
},
enable_installer = false, -- enable installer module

time = {}, -- Time based colorscheme switch
-- time = {
-- ["rose_pine"] = { "13-14", "15-16" }, -- syntax ["colorscheme"] = { "start-end", "start2-end2" },
-- Apply rose_pine from 1300 to 1400 hours and then from 1500 to 1600 hours, for rest of the day use the colorscheme in 'colorscheme' variable
-- },
}
```

Expand Down
1 change: 1 addition & 0 deletions colors/themer_catppuccin-frappe.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("themer").setup({ colorscheme = "catppuccin-frappe" })
1 change: 1 addition & 0 deletions colors/themer_catppuccin-latte.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("themer").setup({ colorscheme = "catppuccin-latte" })
1 change: 1 addition & 0 deletions colors/themer_catppuccin-macchiato.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("themer").setup({ colorscheme = "catppuccin-macchiato" })
1 change: 1 addition & 0 deletions colors/themer_catppuccin-mocha.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("themer").setup({ colorscheme = "catppuccin-mocha" })
1 change: 1 addition & 0 deletions colors/themer_dayfox.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("themer").setup({ colorscheme = "dayfox" })
1 change: 1 addition & 0 deletions colors/themer_gruvbox-light-medium.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("themer").setup({ colorscheme = "gruvbox-light-medium" })
1 change: 1 addition & 0 deletions colors/themer_gruvchad.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("themer").setup({ colorscheme = "gruvchad" })
1 change: 1 addition & 0 deletions colors/themer_horizon-dark.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("themer").setup({ colorscheme = "horizon-dark" })
1 change: 1 addition & 0 deletions colors/themer_nightfox.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("themer").setup({ colorscheme = "nightfox" })
1 change: 1 addition & 0 deletions colors/themer_untitled.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("themer").setup({ colorscheme = "untitled" })
188 changes: 188 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
description = "Dev Shell For Meteroite";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
flake-utils.url = "github:numtide/flake-utils/master";
devshell.url = "github:numtide/devshell/master";
nvim-nightly.url = "github:nix-community/neovim-nightly-overlay";
};
outputs = { self, nixpkgs, flake-utils, nvim-nightly, devshell }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ devshell.overlay nvim-nightly.overlay ];
};

in {
devShell = pkgs.devshell.mkShell {
name = "themer-dev-shell";
packages = with pkgs; [ neovim-nightly stylua selene sumneko-lua-language-server alejandra rnix-lsp luajit ];
};
});
}
10 changes: 4 additions & 6 deletions lua/telescope/_extensions/themes.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
local has_telescope, telescope = pcall(require, "telescope")
if not has_telescope then
vim.notify("Themer: The themes picker needs nvim-telescope/telescope.nvim", vim.log.levels.ERROR)
end
local telescope = require("telescope")
local actions = require("telescope.actions")
local action_state = require("telescope.actions.state")
local pickers = require("telescope.pickers")
local finders = require("telescope.finders")
local config = require("themer.config").options

local function get_theme()
local disable_themes = require("themer.config")("get").disable_telescope_themes
local disable_themes = config.disable_telescope_themes
-- local themes = {}
-- local theme_dir = debug.getinfo(2, "S").source:sub(2)
-- theme_dir = theme_dir:gsub("lua/telescope/_extensions/themes.lua", "")
Expand Down Expand Up @@ -78,7 +76,7 @@ local function themer(opts)
}),
previewer = false,
attach_mappings = function(prompt_bufnr, map)
for type, value in pairs(require("themer.config")("get").telescope_mappings) do
for type, value in pairs(config.telescope_mappings) do
for bind, method in pairs(value) do
map(type, bind, function()
if method == "enter" then
Expand Down
66 changes: 34 additions & 32 deletions lua/themer/config.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
local options = {
local config = {}

config.options = {
colorscheme = nil, -- default colorscheme
transparent = false,
term_colors = true,
Expand Down Expand Up @@ -60,11 +62,11 @@ local options = {
-- }
-- },
-- remaps.highlights = {
-- rose_pine = {
-- base = {
-- Normal = { bg = "#000000" }
-- },
-- }
-- rose_pine = function(cp) -- cp is the color palette
-- return { base = {
-- Normal = { bg = cp.fg }
-- },}
-- end,
-- },
--
-- Also you can do remaps.highlights.globals for global highlight remaps
Expand All @@ -85,6 +87,7 @@ local options = {
gitsigns = true,
lsp = true,
telescope = true,
nvim_tree = true,
},

-- Default telescope picker mappings
Expand All @@ -104,35 +107,34 @@ local options = {
},

enable_installer = false, -- toggle to enable installer

time = { enable = false }, -- Time based colorscheme switch
-- time = {
-- ["rose_pine"] = { "13-14", "15-16" }, -- syntax ["colorscheme"] = { "start-end", "start2-end2" },
-- Apply rose_pine from 1300 to 1400 hours and then from 1500 to 1600 hours, for rest of the day use the colorscheme in 'colorscheme' variable
-- },
}

--- [[
--- internal: iterate given options over the default config (for internal purposes)
--- user: iterate given options over the default config and loads the colorscheme
--- get: returns the options
--- ]]
--- @param type string
--- @param opts table
local setup = function(type, opts)
if type == "get" then
return options
elseif type == "internal" then
options = vim.tbl_deep_extend("force", options, opts or {})
elseif type == "user" then
options = vim.tbl_deep_extend("force", options, opts or {})
if options.colorscheme then
require("themer.modules.core")(options.colorscheme)
end
-- Load installed themes
if options.enable_installer then
if require("themer.utils.fs").exists(vim.fn.stdpath("data") .. "/themer") ~= true then
os.execute("mkdir " .. vim.fn.stdpath("data") .. "/themer")
end
vim.cmd([[command! -nargs=0 ThemerInstall :lua require("themer.modules.installer").fuzzy_install()]])
vim.cmd([[command! -nargs=0 ThemerUnInstall :lua require("themer.modules.installer").fuzzy_uninstall()]])
require("themer.modules.installer.load_installed").load_installed_themes()
end
config.setup = function(opts)
config.options = vim.tbl_deep_extend("force", config.options, opts or {})

-- time module
if config.options.time.enable then
config.options.colorscheme = require("themer.modules.time")(config.options.colorscheme, config.options.time)
end

-- load colorscheme
if config.options.colorscheme then
require("themer.modules.core")(config.options.colorscheme)
end

-- Load installed themes
if config.options.enable_installer then
vim.defer_fn(function()
require("themer.modules.installer.utils").load_installer()
end, 10)
end
end

return setup
return config
2 changes: 1 addition & 1 deletion lua/themer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local init = {}
---@param opts table
init.setup = function(opts)
opts = opts or {}
require("themer.config")("user", opts)
require("themer.config").setup(opts)
end

return init
Loading