basic support for base16 templates
This commit is contained in:
parent
d78da97be7
commit
df75571c56
21
flake.nix
21
flake.nix
@ -1,5 +1,16 @@
|
||||
{
|
||||
outputs = { self, nixpkgs }: {
|
||||
inputs = {
|
||||
base16-rofi = {
|
||||
url = "git+ssh://git@gitlab.com/0xdec/base16-rofi.git";
|
||||
flake = false;
|
||||
};
|
||||
base16-kitty = {
|
||||
url = "github:kdrag0n/base16-kitty";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@inputs: {
|
||||
nixosModules = {
|
||||
ezpassthru = import ./modules/ezpassthru.nix;
|
||||
ezpc = import ./modules/ezpc.nix;
|
||||
@ -13,7 +24,11 @@
|
||||
|
||||
homeManagerModules = {
|
||||
ezpcusr = import ./home-manager/modules/ezpcusr.nix;
|
||||
all = import ./home-manager/modules/default.nix;
|
||||
ezchromium = import ./home-manager/modules/ezchromium.nix;
|
||||
ezcodium = import ./home-manager/modules/ezcodium.nix;
|
||||
colors = import ./home-manager/modules/colors.nix inputs;
|
||||
fonts = import ./home-manager/modules/fonts.nix;
|
||||
all = import ./home-manager/modules/default.nix inputs;
|
||||
};
|
||||
|
||||
# Not really modules? but eh
|
||||
@ -22,7 +37,7 @@
|
||||
nixosModules.common-glooder = import ./users/glooder.nix;
|
||||
nixosModules.common-chekkie = import ./users/chekkie.nix;
|
||||
|
||||
homeManagerModules.common = import ./home-manager/common.nix;
|
||||
homeManagerModules.common = import ./home-manager/common.nix inputs;
|
||||
homeManagerModules.common-notgne2 = import ./home-manager/users/notgne2.nix;
|
||||
homeManagerModules.common-notgne2_pc = import ./home-manager/users/notgne2_pc.nix;
|
||||
homeManagerModules.common-glooder = import ./home-manager/users/glooder.nix;
|
||||
|
@ -1,7 +1,8 @@
|
||||
inputs:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./modules ];
|
||||
imports = [ (import ./modules inputs) ];
|
||||
|
||||
programs.vim = {
|
||||
enable = true;
|
||||
|
@ -1,38 +0,0 @@
|
||||
name: base16:
|
||||
|
||||
''
|
||||
# Base16 ${name} - kitty color config
|
||||
# Scheme generated by ezpcusr in Nix
|
||||
background #${base16."base00"}
|
||||
foreground #${base16."base05"}
|
||||
selection_background #${base16."base05"}
|
||||
selection_foreground #${base16."base00"}
|
||||
url_color #${base16."base04"}
|
||||
cursor #${base16."base05"}
|
||||
active_border_color #${base16."base03"}
|
||||
inactive_border_color #${base16."base01"}
|
||||
active_tab_background #${base16."base00"}
|
||||
active_tab_foreground #${base16."base05"}
|
||||
inactive_tab_background #${base16."base01"}
|
||||
inactive_tab_foreground #${base16."base04"}
|
||||
|
||||
# normal
|
||||
color0 #${base16."base00"}
|
||||
color1 #${base16."base08"}
|
||||
color2 #${base16."base0B"}
|
||||
color3 #${base16."base0A"}
|
||||
color4 #${base16."base0D"}
|
||||
color5 #${base16."base0E"}
|
||||
color6 #${base16."base0C"}
|
||||
color7 #${base16."base05"}
|
||||
|
||||
# bright
|
||||
color8 #${base16."base03"}
|
||||
color9 #${base16."base09"}
|
||||
color10 #${base16."base01"}
|
||||
color11 #${base16."base02"}
|
||||
color12 #${base16."base04"}
|
||||
color13 #${base16."base06"}
|
||||
color14 #${base16."base0F"}
|
||||
color15 #${base16."base05"}
|
||||
''
|
@ -1,150 +0,0 @@
|
||||
name: base16:
|
||||
|
||||
''
|
||||
/**
|
||||
* Base16 {{scheme-name}} ROFI Color theme
|
||||
*
|
||||
* Authors
|
||||
* Scheme: {{scheme-author}}
|
||||
* Template: Jordi Pakey-Rodriguez (https://github.com/0xdec), Andrea Scarpino (https://github.com/ilpianista)
|
||||
*/
|
||||
|
||||
* {
|
||||
red: #${base16."base08"};
|
||||
blue: #${base16."base0D"};
|
||||
lightfg: #${base16."base06"};
|
||||
lightbg: #${base16."base01"};
|
||||
foreground: #${base16."base05"};
|
||||
background: #${base16."base00"};
|
||||
background-color: #${base16."base00"};
|
||||
separatorcolor: @foreground;
|
||||
border-color: @foreground;
|
||||
selected-normal-foreground: @lightbg;
|
||||
selected-normal-background: @lightfg;
|
||||
selected-active-foreground: @background;
|
||||
selected-active-background: @blue;
|
||||
selected-urgent-foreground: @background;
|
||||
selected-urgent-background: @red;
|
||||
normal-foreground: @foreground;
|
||||
normal-background: @background;
|
||||
active-foreground: @blue;
|
||||
active-background: @background;
|
||||
urgent-foreground: @red;
|
||||
urgent-background: @background;
|
||||
alternate-normal-foreground: @foreground;
|
||||
alternate-normal-background: @lightbg;
|
||||
alternate-active-foreground: @blue;
|
||||
alternate-active-background: @lightbg;
|
||||
alternate-urgent-foreground: @red;
|
||||
alternate-urgent-background: @lightbg;
|
||||
spacing: 2;
|
||||
}
|
||||
window {
|
||||
background-color: @background;
|
||||
border: 1;
|
||||
padding: 5;
|
||||
}
|
||||
mainbox {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
message {
|
||||
border: 1px dash 0px 0px ;
|
||||
border-color: @separatorcolor;
|
||||
padding: 1px ;
|
||||
}
|
||||
textbox {
|
||||
text-color: @foreground;
|
||||
}
|
||||
listview {
|
||||
fixed-height: 0;
|
||||
border: 2px dash 0px 0px ;
|
||||
border-color: @separatorcolor;
|
||||
spacing: 2px ;
|
||||
scrollbar: true;
|
||||
padding: 2px 0px 0px ;
|
||||
}
|
||||
element {
|
||||
border: 0;
|
||||
padding: 1px ;
|
||||
}
|
||||
element normal.normal {
|
||||
background-color: @normal-background;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
element normal.urgent {
|
||||
background-color: @urgent-background;
|
||||
text-color: @urgent-foreground;
|
||||
}
|
||||
element normal.active {
|
||||
background-color: @active-background;
|
||||
text-color: @active-foreground;
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: @selected-normal-background;
|
||||
text-color: @selected-normal-foreground;
|
||||
}
|
||||
element selected.urgent {
|
||||
background-color: @selected-urgent-background;
|
||||
text-color: @selected-urgent-foreground;
|
||||
}
|
||||
element selected.active {
|
||||
background-color: @selected-active-background;
|
||||
text-color: @selected-active-foreground;
|
||||
}
|
||||
element alternate.normal {
|
||||
background-color: @alternate-normal-background;
|
||||
text-color: @alternate-normal-foreground;
|
||||
}
|
||||
element alternate.urgent {
|
||||
background-color: @alternate-urgent-background;
|
||||
text-color: @alternate-urgent-foreground;
|
||||
}
|
||||
element alternate.active {
|
||||
background-color: @alternate-active-background;
|
||||
text-color: @alternate-active-foreground;
|
||||
}
|
||||
scrollbar {
|
||||
width: 4px ;
|
||||
border: 0;
|
||||
handle-color: @normal-foreground;
|
||||
handle-width: 8px ;
|
||||
padding: 0;
|
||||
}
|
||||
sidebar {
|
||||
border: 2px dash 0px 0px ;
|
||||
border-color: @separatorcolor;
|
||||
}
|
||||
button {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
button selected {
|
||||
background-color: @selected-normal-background;
|
||||
text-color: @selected-normal-foreground;
|
||||
}
|
||||
inputbar {
|
||||
spacing: 0px;
|
||||
text-color: @normal-foreground;
|
||||
padding: 1px ;
|
||||
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
|
||||
}
|
||||
case-indicator {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
entry {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
prompt {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
textbox-prompt-colon {
|
||||
expand: false;
|
||||
str: ":";
|
||||
margin: 0px 0.3000em 0.0000em 0.0000em ;
|
||||
text-color: inherit;
|
||||
}
|
||||
''
|
@ -1,3 +1,4 @@
|
||||
inputs:
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
@ -11,17 +12,48 @@ let
|
||||
add = l: lib.foldr ({ n, x }: c: (x * (pow 16 n)) + c) 0 (lib.imap0 (n: x: { inherit n x; }) l);
|
||||
calc = s: add (builtins.map fin (builtins.filter (x: builtins.isString x && builtins.stringLength x == 1) (builtins.split "" s)));
|
||||
|
||||
hexToRgb = c:
|
||||
splitHex = c:
|
||||
let
|
||||
s' = builtins.match "(..)(..)(..)|(.)(.)(.)" c;
|
||||
ss = builtins.elemAt s';
|
||||
o = if ss 0 == null then 3 else 0;
|
||||
in
|
||||
builtins.mapAttrs (_: calc) {
|
||||
in {
|
||||
r = ss (0 + o);
|
||||
g = ss (1 + o);
|
||||
b = ss (2 + o);
|
||||
};
|
||||
|
||||
hexToRgb = c: builtins.mapAttrs (_: calc) (splitHex c);
|
||||
|
||||
hexToAlphaCss = c: a: with hexToRgb c; "rgba(${r}, ${g}, ${b}, ${a})";
|
||||
|
||||
makeScheme = base16: lib.mapAttrs' (k: v: lib.nameValuePair "${k}-hex" v) base16 //
|
||||
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-hex-r" (splitHex v).r) base16 //
|
||||
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-hex-g" (splitHex v).g) base16 //
|
||||
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-hex-b" (splitHex v).b) base16 //
|
||||
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-rgb-r" (hexToRgb v).r) base16 //
|
||||
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-rgb-g" (hexToRgb v).g) base16 //
|
||||
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-rgb-b" (hexToRgb v).b) base16 //
|
||||
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-dec-r" ((hexToRgb v).r / 255.0)) base16 //
|
||||
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-dec-g" ((hexToRgb v).g / 255.0)) base16 //
|
||||
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-dec-b" ((hexToRgb v).b / 255.0)) base16;
|
||||
|
||||
mustache = scheme: name: src:
|
||||
pkgs.stdenv.mkDerivation (
|
||||
{
|
||||
name = lib.strings.sanitizeDerivationName name;
|
||||
inherit src;
|
||||
data = pkgs.writeText "${name}-data" (builtins.toJSON scheme);
|
||||
phases = [ "buildPhase" ];
|
||||
buildPhase = "${pkgs.mustache-go}/bin/mustache $data $src > $out";
|
||||
}
|
||||
);
|
||||
|
||||
genTheme = repo: mustache (makeScheme cfg.base16 // {
|
||||
scheme-name = cfg.favColors.name;
|
||||
scheme-slug = "idk";
|
||||
scheme-author = "nixos";
|
||||
}) cfg.favColors.name "${repo}/templates/default.mustache";
|
||||
in
|
||||
{
|
||||
options.colors = {
|
||||
@ -164,7 +196,7 @@ in
|
||||
mkIf cfg.enable {
|
||||
# Read only utility attributes
|
||||
colors.base16 = cfg.favColors.base16;
|
||||
colors.base16Rgb = builtins.map hexToRgb cfg.favColors.base16;
|
||||
colors.base16Rgb = builtins.mapAttrs hexToRgb cfg.favColors.base16;
|
||||
|
||||
# Element
|
||||
xdg.configFile."Riot/config.json".text = builtins.toJSON elementConfig;
|
||||
@ -248,31 +280,11 @@ in
|
||||
};
|
||||
|
||||
# Rofi
|
||||
programs.rofi = {
|
||||
theme = (
|
||||
pkgs.writeText "rofi-base16-config"
|
||||
(
|
||||
(import ../data/rofi-base16.nix)
|
||||
cfg.favColors.name
|
||||
cfg.favColors.base16
|
||||
)
|
||||
).outPath;
|
||||
};
|
||||
programs.rofi.theme = "${genTheme inputs.base16-rofi}";
|
||||
|
||||
# Kitty
|
||||
programs.kitty.extraConfig =
|
||||
let
|
||||
kittyColors =
|
||||
pkgs.writeText
|
||||
"favcolors-kitty-${cfg.favColors.name}.conf"
|
||||
(
|
||||
(import ../data/kitty-base16.nix)
|
||||
cfg.favColors.name
|
||||
cfg.favColors.base16
|
||||
);
|
||||
in
|
||||
''
|
||||
include ${kittyColors}
|
||||
programs.kitty.extraConfig = ''
|
||||
include ${genTheme inputs.base16-kitty}
|
||||
'';
|
||||
|
||||
# neovim
|
||||
@ -343,7 +355,8 @@ in
|
||||
|
||||
home.file = lib.mkMerge
|
||||
[
|
||||
(mkIf config.programs.vscode.enable {
|
||||
(
|
||||
mkIf config.programs.vscode.enable {
|
||||
".vscode-oss/extensions/base16-1.0.0/themes/nix-colors.json".text = (import ../data/codium-base16.nix) cfg.favColors.name cfg.favColors.base16;
|
||||
".vscode-oss/extensions/base16-1.0.0/package.json".text = builtins.toJSON {
|
||||
name = "nix colors";
|
||||
@ -364,7 +377,8 @@ in
|
||||
}
|
||||
];
|
||||
};
|
||||
})
|
||||
}
|
||||
)
|
||||
];
|
||||
};
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
inputs:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
@ -9,7 +10,7 @@
|
||||
./ezpcusr.nix
|
||||
./ezchromium.nix
|
||||
./ezcodium.nix
|
||||
./colors.nix
|
||||
(import ./colors.nix inputs)
|
||||
./fonts.nix
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user