Convert palette to OKLCH
This commit is contained in:
parent
a9f123991d
commit
4743612db0
3 changed files with 33 additions and 34 deletions
|
@ -46,7 +46,6 @@ sudo nix-channel --add 'https://github.com/NixOS/nixos-hardware/archive/master.t
|
|||
|
||||
# User
|
||||
nix-channel --add "https://github.com/nix-community/home-manager/archive/release-$RELEASE.tar.gz" 'home-manager'
|
||||
nix-channel --add 'https://github.com/misterio77/nix-colors/archive/main.tar.gz' 'nix-colors'
|
||||
nix-channel --add 'https://github.com/xddxdd/nix-math/archive/master.tar.gz' 'nix-math'
|
||||
nix-channel --add 'https://nixos.org/channels/nixos-unstable' 'unstable'
|
||||
nix-channel --add 'https://github.com/nix-community/nix-vscode-extensions/archive/master.tar.gz' 'community-vscode-extensions'
|
||||
|
|
|
@ -34,7 +34,7 @@ in
|
|||
dconf.settings."org/gnome/desktop/background".picture-uri-dark = host.background;
|
||||
dconf.settings."org/gnome/desktop/screensaver".picture-uri = host.background;
|
||||
dconf.settings."org/gtk/settings/color-chooser".custom-colors = with palette.rgb;
|
||||
map (rgb: mkTuple (rgb ++ [ 1.0 ]))
|
||||
map ({ r, g, b }: mkTuple [ r g b 1.0 ])
|
||||
[ red green yellow blue orange purple ];
|
||||
|
||||
# Shell
|
||||
|
|
|
@ -1,49 +1,47 @@
|
|||
{ lib }:
|
||||
|
||||
let
|
||||
inherit (builtins) listToAttrs mapAttrs substring;
|
||||
inherit (builtins) listToAttrs mapAttrs;
|
||||
inherit (lib) imap0 mapAttrsRecursive nameValuePair;
|
||||
inherit ((import <nix-colors> { }).lib.conversions) hexToRGB;
|
||||
inherit (import ./lib.nix { inherit lib; }) oklchToRgb rgbToHex;
|
||||
|
||||
ansiNames = [ "black" "red" "green" "yellow" "blue" "magenta" "cyan" "white" ];
|
||||
|
||||
hex = {
|
||||
oklch = rec {
|
||||
# Monokai
|
||||
black = "#1b1b1b";
|
||||
blue = "#66d9ef";
|
||||
gray = "#666666";
|
||||
green = "#a6e22e";
|
||||
orange = "#fd971f";
|
||||
purple = "#ae81ff";
|
||||
red = "#f92672";
|
||||
white = "#f8f8f8";
|
||||
yellow = "#e6db74";
|
||||
black = { l = 0.22; c = 0.000; h = 0; };
|
||||
blue = { l = 0.83; c = 0.108; h = 212; };
|
||||
gray = { l = 0.51; c = 0.000; h = 0; };
|
||||
green = { l = 0.84; c = 0.204; h = 127; };
|
||||
orange = { l = 0.77; c = 0.168; h = 62; };
|
||||
purple = { l = 0.70; c = 0.181; h = 298; };
|
||||
red = { l = 0.64; c = 0.240; h = 7; };
|
||||
white = { l = 0.98; c = 0.000; h = 0; };
|
||||
yellow = { l = 0.88; c = 0.125; h = 103; };
|
||||
|
||||
# Extended
|
||||
orange-red = "#fc5b2d";
|
||||
teal = "#29e0b4";
|
||||
orange-red = { l = 0.68; c = 0.205; h = 36; };
|
||||
teal = { l = 0.81; c = 0.152; h = 171; };
|
||||
|
||||
# Derived
|
||||
alt-blue = "#5ac1d5";
|
||||
alt-green = "#93c928";
|
||||
alt-orange = "#e1851a";
|
||||
alt-orange-red = "#dd4915";
|
||||
alt-purple = "#9f60ff";
|
||||
alt-red = "#d71b60";
|
||||
alt-teal = "#23c7a0";
|
||||
alt-yellow = "#cdc367";
|
||||
dark-gray = "#3a3a3a";
|
||||
dark-orange-red = "#522c21";
|
||||
dark-orange-red-text-contrast = "#917a74";
|
||||
dark-purple = "#634994";
|
||||
dark-red = "#c4265e";
|
||||
dark-teal = "#134739";
|
||||
light-gray = "#dddddd";
|
||||
alt-blue = blue // { l = 0.76; };
|
||||
alt-green = green // { l = 0.77; c = 0.198; };
|
||||
alt-orange = orange // { l = 0.70; c = 0.161; };
|
||||
alt-orange-red = orange-red // { l = 0.61; };
|
||||
alt-purple = purple // { l = 0.64; };
|
||||
alt-red = red // { l = 0.57; c = 0.217; };
|
||||
alt-teal = teal // { l = 0.74; c = 0.144; };
|
||||
alt-yellow = yellow // { l = 0.81; };
|
||||
dark-gray = gray // { l = 0.35; };
|
||||
dark-orange-red = orange-red // { l = 0.34; c = 0.060; };
|
||||
dark-orange-red-text-contrast = orange-red // { l = 0.60; c = 0.030; };
|
||||
dark-purple = purple // { l = 0.47; };
|
||||
dark-red = red // { l = 0.54; c = 0.216; };
|
||||
dark-teal = teal // { l = 0.36; c = 0.060; };
|
||||
light-gray = gray // { l = 0.90; };
|
||||
};
|
||||
in
|
||||
rec {
|
||||
inherit hex;
|
||||
|
||||
ansi =
|
||||
let
|
||||
base = listToAttrs (imap0 (i: n: nameValuePair n (toString (30 + i))) ansiNames);
|
||||
|
@ -53,5 +51,7 @@ rec {
|
|||
|
||||
ansiFormat = mapAttrsRecursive (_: a: t: "[${a}m${t}[0m") ansi;
|
||||
|
||||
rgb = mapAttrs (_: h: map (c: c / 255.0) (hexToRGB (substring 1 6 h))) hex;
|
||||
hex = mapAttrs (_: rgbToHex) rgb;
|
||||
|
||||
rgb = mapAttrs (_: oklchToRgb) oklch;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue