feat: add theme
shamelessly stolen from github:jnsgruk/nixos-config Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
This commit is contained in:
parent
63f21c6a3f
commit
0344d3ca8a
5 changed files with 207 additions and 1 deletions
|
|
@ -1,4 +1,7 @@
|
|||
{ pkgs, self, ... }:
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
theme = import ../../../lib/theme { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
|
|
@ -17,6 +20,11 @@
|
|||
|
||||
live_config_reload = true;
|
||||
scrolling.history = 100000;
|
||||
|
||||
font = {
|
||||
normal.family = "${theme.fonts.monospace.name}";
|
||||
size = 14;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
61
lib/theme/colours.nix
Normal file
61
lib/theme/colours.nix
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
rec {
|
||||
colours = rec {
|
||||
inherit (catppuccin-macchiato)
|
||||
pink
|
||||
red
|
||||
yellow
|
||||
green
|
||||
;
|
||||
inherit (catppuccin-macchiato) subtext0 subtext1 text;
|
||||
inherit (catppuccin-macchiato) overlay0 overlay1 overlay2;
|
||||
inherit (catppuccin-macchiato) surface0 surface1 surface2;
|
||||
|
||||
accent = darkBlue;
|
||||
black = catppuccin-macchiato.crust;
|
||||
white = catppuccin-macchiato.rosewater;
|
||||
lightPink = catppuccin-macchiato.flamingo;
|
||||
lightRed = catppuccin-macchiato.maroon;
|
||||
orange = catppuccin-macchiato.peach;
|
||||
cyan = catppuccin-macchiato.teal;
|
||||
blue = catppuccin-macchiato.sapphire;
|
||||
darkBlue = catppuccin-macchiato.blue;
|
||||
lightBlue = catppuccin-macchiato.sky;
|
||||
purple = catppuccin-macchiato.mauve;
|
||||
lightPurple = catppuccin-macchiato.lavender;
|
||||
bg = catppuccin-macchiato.base;
|
||||
bgDark = catppuccin-macchiato.mantle;
|
||||
};
|
||||
|
||||
catppuccin-macchiato = {
|
||||
rosewater = "#f4dbd6";
|
||||
flamingo = "#f0c6c6";
|
||||
pink = "#f5bde6";
|
||||
mauve = "#c6a0f6";
|
||||
red = "#ed8796";
|
||||
maroon = "#ee99a0";
|
||||
peach = "#f5a97f";
|
||||
yellow = "#eed49f";
|
||||
green = "#a6da95";
|
||||
teal = "#8bd5ca";
|
||||
sky = "#91d7e3";
|
||||
sapphire = "#7dc4e4";
|
||||
blue = "#8aadf4";
|
||||
lavender = "#b7bdf8";
|
||||
|
||||
subtext0 = "#a5adcb";
|
||||
subtext1 = "#b8c0e0";
|
||||
text = "#cad3f5";
|
||||
|
||||
overlay0 = "#6e738d";
|
||||
overlay1 = "#8087a2";
|
||||
overlay2 = "#939ab7";
|
||||
|
||||
surface0 = "#363a4f";
|
||||
surface1 = "#494d64";
|
||||
surface2 = "#5b6078";
|
||||
|
||||
base = "#24273a";
|
||||
crust = "#181926";
|
||||
mantle = "#1e2030";
|
||||
};
|
||||
}
|
||||
69
lib/theme/default.nix
Normal file
69
lib/theme/default.nix
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit ((import ./colours.nix)) colours;
|
||||
libx = import ./lib.nix { inherit (pkgs) lib; };
|
||||
in
|
||||
rec {
|
||||
inherit (libx) hexToRgb;
|
||||
inherit colours;
|
||||
|
||||
catppuccin = {
|
||||
flavor = "macchiato";
|
||||
accent = "blue";
|
||||
size = "standard";
|
||||
};
|
||||
|
||||
wallpaper = ./wallpapers/norway.png;
|
||||
|
||||
gtkTheme = {
|
||||
name = "catppuccin-macchiato-blue-standard";
|
||||
package = pkgs.catppuccin-gtk.override {
|
||||
size = catppuccin.size;
|
||||
variant = catppuccin.flavor;
|
||||
accents = [ catppuccin.accent ];
|
||||
};
|
||||
};
|
||||
|
||||
qtTheme = {
|
||||
name = "Catppuccin-Macchiato-Blue";
|
||||
package = pkgs.catppuccin-kvantum.override {
|
||||
variant = "Macchiato";
|
||||
accent = "Blue";
|
||||
};
|
||||
};
|
||||
|
||||
iconTheme = rec {
|
||||
name = "Papirus-Dark";
|
||||
package = pkgs.papirus-icon-theme;
|
||||
iconPath = "${package}/share/icons/${name}";
|
||||
};
|
||||
|
||||
cursorTheme = {
|
||||
name = "Adwaita";
|
||||
package = pkgs.adwaita-icon-theme;
|
||||
size = 24;
|
||||
};
|
||||
|
||||
fonts = {
|
||||
default = {
|
||||
name = "Inter";
|
||||
package = pkgs.inter;
|
||||
size = "11";
|
||||
};
|
||||
iconFont = {
|
||||
name = "Inter";
|
||||
package = pkgs.inter;
|
||||
};
|
||||
monospace = {
|
||||
name = "MesloLGSDZ Nerd Font Mono";
|
||||
package = pkgs.nerdfonts.override { fonts = [ "Meslo" ]; };
|
||||
};
|
||||
emoji = {
|
||||
name = "Joypixels";
|
||||
package = pkgs.joypixels;
|
||||
};
|
||||
};
|
||||
}
|
||||
68
lib/theme/lib.nix
Normal file
68
lib/theme/lib.nix
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
{ lib, ... }:
|
||||
with lib;
|
||||
rec {
|
||||
# color-related functions
|
||||
|
||||
# convert rrggbb hex to #rrggbb
|
||||
x = c: "#${c}";
|
||||
|
||||
# convert #rrggbb -> r, g, b
|
||||
hexToRgb =
|
||||
c:
|
||||
let
|
||||
r = toString (hexToDec (__substring 1 2 c));
|
||||
g = toString (hexToDec (__substring 3 2 c));
|
||||
b = toString (hexToDec (__substring 5 2 c));
|
||||
res = "${r}, ${g}, ${b}";
|
||||
in
|
||||
res;
|
||||
|
||||
# functions copied from https://gist.github.com/corpix/f761c82c9d6fdbc1b3846b37e1020e11
|
||||
# convert a hex value to an integer
|
||||
hexToDec =
|
||||
v:
|
||||
let
|
||||
hexToInt = {
|
||||
"0" = 0;
|
||||
"1" = 1;
|
||||
"2" = 2;
|
||||
"3" = 3;
|
||||
"4" = 4;
|
||||
"5" = 5;
|
||||
"6" = 6;
|
||||
"7" = 7;
|
||||
"8" = 8;
|
||||
"9" = 9;
|
||||
"a" = 10;
|
||||
"b" = 11;
|
||||
"c" = 12;
|
||||
"d" = 13;
|
||||
"e" = 14;
|
||||
"f" = 15;
|
||||
"A" = 10;
|
||||
"B" = 11;
|
||||
"C" = 12;
|
||||
"D" = 13;
|
||||
"E" = 14;
|
||||
"F" = 15;
|
||||
};
|
||||
chars = stringToCharacters v;
|
||||
charsLen = length chars;
|
||||
in
|
||||
foldl (a: v: a + v) 0 (imap0 (k: v: hexToInt."${v}" * (pow 16 (charsLen - k - 1))) chars);
|
||||
|
||||
pow =
|
||||
let
|
||||
pow' =
|
||||
base: exponent: value:
|
||||
# FIXME: It will silently overflow on values > 2**62 :(
|
||||
# The value will become negative or zero in this case
|
||||
if exponent == 0 then
|
||||
1
|
||||
else if exponent <= 1 then
|
||||
value
|
||||
else
|
||||
(pow' base (exponent - 1) (value * base));
|
||||
in
|
||||
base: exponent: pow' base exponent base;
|
||||
}
|
||||
BIN
lib/theme/wallpapers/norway.png
Normal file
BIN
lib/theme/wallpapers/norway.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
Loading…
Add table
Add a link
Reference in a new issue