Skip to content

Commit

Permalink
confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
bloxx12 committed Jan 18, 2025
1 parent e51dce0 commit a37625c
Show file tree
Hide file tree
Showing 12 changed files with 319 additions and 32 deletions.
14 changes: 7 additions & 7 deletions flake.lock

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

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@

# Themes
plugin-base16 = {
url = "github:rrethy/base16-nvim";
url = "github:echasnovski/mini.base16";
flake = false;
};

Expand Down
1 change: 1 addition & 0 deletions modules/plugins/theme/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
imports = [
./theme.nix
./config.nix
./supported-themes
];
}
25 changes: 25 additions & 0 deletions modules/plugins/theme/supported-themes/base16.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{lib, ...}: let
inherit (lib.strings) hasPrefix;
inherit (lib.attrsets) listToAttrs;
inherit (lib.options) mkOption;
inherit (lib.nvim.types) hexColor mkPluginSetupOption;

numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"];
base16Options = listToAttrs (map (n: {
name = "base0${n}";
value = mkOption {
description = "The base0${n} color to use";
type = hexColor;
apply = v:
if hasPrefix "#" v
then v
else "#${v}";
};
})
numbers);
in {
base16 = {
setupOpts = mkPluginSetupOption "base16" base16Options;
setup = "";
};
}
70 changes: 70 additions & 0 deletions modules/plugins/theme/supported-themes/cattpuccin.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
config,
lib,
...
}: let
inherit (lib.attrsets) genAttrs;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) bool str;
inherit (lib.nvim.types) mkPluginSetupOption;
cfg = config.vim.theme;

mkEnableOption' = name: mkEnableOption name // {default = true;};
in {
catppuccin = {
setupOpts = mkPluginSetupOption "catppuccin" {
flavour = mkOption {
type = str;
default = cfg.style;
# internal = true;
};
transparent_background = mkOption {
type = bool;
default = cfg.transparent;
internal = true;
};
term_colors = mkEnableOption' "term_colors";
integrations =
{
nvimtree = {
enabled = mkEnableOption' "enabled";
transparent_panel = mkOption {
type = bool;
default = cfg.transparent;
};
show_root = mkEnableOption' "show_root";
};

navic = {
enabled = mkEnableOption' "enabled";
# lualine will set backgound to mantle

Check warning on line 40 in modules/plugins/theme/supported-themes/cattpuccin.nix

View workflow job for this annotation

GitHub Actions / check-typos

"backgound" should be "background".
custom_bg = mkOption {
type = str;
default = "NONE";
};
};
}
// genAttrs [
"hop"
"gitsigns"
"telescope"
"treesitter"
"treesitter_context"
"ts_rainbow"
"fidget"
"alpha"
"leap"
"markdown"
"noice"
"notify"
"which_key"
] (name: mkEnableOption' name);
};
setup = ''
-- Catppuccin theme
-- setup must be called before loading
vim.cmd.colorscheme "catppuccin"
'';
styles = ["mocha" "latte" "frappe" "macchiato"];
};
}
12 changes: 12 additions & 0 deletions modules/plugins/theme/supported-themes/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
_: {
imports = [
./base16.nix
./cattpuccin.nix
./dracula.nix
./dracula.nix
./gruvbox.nix
./onedark.nix
./rose-pine.nix
./tokyonight.nix
];
}
23 changes: 23 additions & 0 deletions modules/plugins/theme/supported-themes/dracula.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
config,
lib,
...
}: let
inherit (lib.options) mkOption;
inherit (lib.types) bool;
inherit (lib.nvim.types) mkPluginSetupOption;
cfg = config.vim.theme;
in {
dracula = {
setupOpts = mkPluginSetupOption "dracula" {
transparent_bg = mkOption {
type = bool;
default = cfg.transparent;
internal = true;
};
};
setup = ''
require('dracula').load();
'';
};
}
65 changes: 65 additions & 0 deletions modules/plugins/theme/supported-themes/gruvbox.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
config,
lib,
...
}: let
inherit (lib.attrsets) genAttrs mergeAttrsList;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) bool str;
inherit (lib.nvim.types) mkPluginSetupOption;
cfg = config.vim.theme;

mkEnableOption' = name: mkEnableOption name // {default = true;};
in {
gruvbox = {
setupOpts =
mkPluginSetupOption "gruvbox" {
transparent_mode = mkOption {
type = bool;
default = cfg.transparent;
internal = true;
};
italic =
{
operators = mkEnableOption "operators";
}
// genAttrs [
"strings"
"emphasis"
"comments"
"folds"
] (name: mkEnableOption' name);

contrast = mkOption {
type = str;
default = "";
};
# TODO: fix these
# palette_overrides = mkLuaInline "{}";
# overrides = mkLuaInline "{}";
}
// mergeAttrsList [
(genAttrs [
"terminal_colors"
"undercurls"
"underline"
"bold"
"strikethrough"
"inverse"
] (name: mkEnableOption' name))
(genAttrs [
"invert_selection"
"invert_signs"
"invert_tabline"
"invert_intend_guides"
"dim_inactive"
] (name: mkEnableOption name))
];
setup = ''
-- Gruvbox theme
vim.o.background = "${cfg.style}"
vim.cmd("colorscheme gruvbox")
'';
styles = ["dark" "light"];
};
}
25 changes: 25 additions & 0 deletions modules/plugins/theme/supported-themes/onedark.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
config,
lib,
...
}: let
inherit (lib.options) mkOption;
inherit (lib.types) str;
inherit (lib.nvim.types) mkPluginSetupOption;
cfg = config.vim.theme;
in {
onedark = {
setupOpts = mkPluginSetupOption "onedark" {
style = mkOption {
type = str;
default = cfg.style;
internal = true;
};
};
setup = ''
-- OneDark theme
require('onedark').load()
'';
styles = ["dark" "darker" "cool" "deep" "warm" "warmer"];
};
}
45 changes: 45 additions & 0 deletions modules/plugins/theme/supported-themes/rose-pine.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
config,
lib,
...
}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) bool str;
inherit (lib.nvim.types) mkPluginSetupOption;
cfg = config.vim.theme;

mkEnableOption' = name: mkEnableOption name // {default = true;};
in {
rose-pine = {
setupOpts = mkPluginSetupOption "rose-pine" {
dark_variant = mkOption {
type = str;
default = cfg.style;
internal = true;
};
dim_inactive_windows = mkEnableOption "dim_inactive_windows";
extend_background_behind_borders = mkEnableOption' "extend_background_behind_borders";

enable = {
terminal = mkEnableOption' "terminal";
migrations = mkEnableOption' "migrations";
};

styles = {
bold = mkEnableOption "bold";
# I would like to add more options for this
italic = mkEnableOption "italic";
transparency = mkOption {
type = bool;
default = cfg.transparent;
internal = true;
};
};
};

setup = ''
vim.cmd("colorscheme rose-pine")
'';
styles = ["main" "moon" "dawn"];
};
}
24 changes: 24 additions & 0 deletions modules/plugins/theme/supported-themes/tokyonight.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
config,
lib,
...
}: let
inherit (lib.options) mkOption;
inherit (lib.types) bool;
inherit (lib.nvim.types) mkPluginSetupOption;
cfg = config.vim.theme;
in {
tokyonight = {
setupOpts = mkPluginSetupOption "tokyonight" {
transparent = mkOption {
type = bool;
default = cfg.transparent;
internal = true;
};
};
setup = ''
vim.cmd[[colorscheme tokyonight-${cfg.style}]]
'';
styles = ["night" "day" "storm" "moon"];
};
}
Loading

0 comments on commit a37625c

Please sign in to comment.