woop woop

This commit is contained in:
Noa Aarts 2024-03-10 20:26:47 +01:00
parent e5eb50c0e9
commit 8f8eb20a8b
11 changed files with 575 additions and 38 deletions

View file

@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
src = fetchgit {
url = "https://github.com/itepastra/automapaper";
rev = "f102526244d954a4e4ae30a4b11f070e821f66ec";
sha256 = "sha256-IS9vqSmDbiLwLwUeIxxPI2t7yksxvACgiECeSV43Wug=";
sha256 = "sha256-WyD8NlA6T0v0ixMpN67Tro1Cy06rmx2FDaf5qriiFQA=";
};
meta = with lib; {

12
custom/colors/default.nix Normal file
View file

@ -0,0 +1,12 @@
{ nixpkgs-lib, ... }: rec {
lib-core = import ./lib/core { inherit nixpkgs-lib; };
lib = lib-core // { contrib = lib-contrib; };
homeManagerModules = rec {
colorScheme = import ./module;
# Alias
colorscheme = colorScheme;
default = colorScheme;
};
homeManagerModule = homeManagerModules.colorScheme;
}

13
custom/colors/flake.nix Normal file
View file

@ -0,0 +1,13 @@
{
description =
"a home-manager module to make theming easier.";
inputs = {
nixpkgs-lib.url = "github:nix-community/nixpkgs.lib";
};
outputs = { self, nixpkgs-lib, color-schemes }:
import ./. {
nixpkgs-lib = nixpkgs-lib.lib;
};
}

View file

@ -0,0 +1,104 @@
{ lib, config, ... }:
with lib;
let
cfg = config.colorScheme;
hexColorType = mkOptionType {
name = "hex-color";
descriptionClass = "noun";
description = "RGB color in hex format";
check = x: isString x && !(hasPrefix "#" x);
};
in
{
imports = [
(mkAliasOptionModule [ "colorscheme" ] [ "colorScheme" ])
(mkRenamedOptionModule [ "colorScheme" "kind" ] [ "colorScheme" "variant" ])
(mkRenamedOptionModule [ "colorScheme" "colors" ] [ "colorScheme" "palette" ])
];
options.colorScheme = {
slug = mkOption {
type = types.str;
example = "awesome-scheme";
description = ''
Color scheme slug (sanitized name)
'';
};
name = mkOption {
type = types.str;
default = "";
example = "Awesome Scheme";
description = ''
Color scheme (pretty) name
'';
};
description = mkOption {
type = types.str;
default = "";
example = "A very nice theme";
description = ''
Color scheme description
'';
};
author = mkOption {
type = types.str;
default = "";
example = "Gabriel Fontes (https://m7.rs)";
description = ''
Color scheme author
'';
};
variant = mkOption {
type = types.enum [ "dark" "light" ];
default =
if builtins.substring 0 1 cfg.palette.base00 < "5" then
"dark"
else
"light";
description = ''
Whether the scheme is dark or light
'';
};
palette = mkOption {
type = with types; attrsOf (
coercedTo str (removePrefix "#") hexColorType
);
default = { };
example = literalExpression ''
{
base00 = "002635";
base01 = "00384d";
base02 = "517F8D";
base03 = "6C8B91";
base04 = "869696";
base05 = "a1a19a";
base06 = "e6e6dc";
base07 = "fafaf8";
base08 = "ff5a67";
base09 = "f08e48";
base0A = "ffcc1b";
base0B = "7fc06e";
base0C = "14747e";
base0D = "5dd7b9";
base0E = "9a70a4";
base0F = "c43060";
}
'';
description = ''
Atribute set of hex colors.
These are usually base00-base0F, but you may use any name you want.
For example, these can have meaningful names (bg, fg), or be base24.
The colorschemes provided by nix-colors follow the base16 standard.
Some might leverage base24 and have 24 colors, but these can be safely
used as if they were base16.
You may include a leading #, but it will be stripped when accessed from
config.colorscheme.palette.
'';
};
};
}

View file

@ -0,0 +1 @@
{ imports = [ ./colorscheme.nix ]; }