Normalize derived colors

This commit is contained in:
Andrew Kvalheim 2024-04-23 15:14:36 -07:00
parent 3a7fd644de
commit f8c243ae89
6 changed files with 49 additions and 44 deletions

View file

@ -149,8 +149,8 @@ in
{ {
"6" = [ red orange yellow green blue purple ]; "6" = [ red orange yellow green blue purple ];
"8" = [ red vermilion orange yellow green teal blue purple ]; "8" = [ red vermilion orange yellow green teal blue purple ];
"12" = [ red red-alt orange orange-alt yellow yellow-alt green green-alt blue blue-alt purple purple-alt ]; "12" = [ red red-dim orange orange-dim yellow yellow-dim green green-dim blue blue-dim purple purple-dim ];
"16" = [ red red-alt vermilion vermilion-alt orange orange-alt yellow yellow-alt green green-alt teal teal-alt blue blue-alt purple purple-alt ]; "16" = [ red red-dim vermilion vermilion-dim orange orange-dim yellow yellow-dim green green-dim teal teal-dim blue blue-dim purple purple-dim ];
}."${toString host.cores}" }."${toString host.cores}"
); );
mem-color = orange; mem-color = orange;

View file

@ -175,7 +175,7 @@ in
# "textlink.foreground" = "#ff7042"; # "textlink.foreground" = "#ff7042";
"terminal.foreground" = white; "terminal.foreground" = white;
"terminal.background" = black; "terminal.background" = black;
"terminal.ansiblack" = gray-dark; "terminal.ansiblack" = white-dark;
"terminal.ansired" = red; "terminal.ansired" = red;
"terminal.ansigreen" = green; "terminal.ansigreen" = green;
"terminal.ansiyellow" = yellow; "terminal.ansiyellow" = yellow;
@ -183,7 +183,7 @@ in
"terminal.ansimagenta" = orange; "terminal.ansimagenta" = orange;
"terminal.ansicyan" = purple; "terminal.ansicyan" = purple;
"terminal.ansiwhite" = white; "terminal.ansiwhite" = white;
"terminal.ansibrightblack" = gray; "terminal.ansibrightblack" = white-dim;
"terminal.ansibrightred" = red; "terminal.ansibrightred" = red;
"terminal.ansibrightgreen" = green; "terminal.ansibrightgreen" = green;
"terminal.ansibrightyellow" = yellow; "terminal.ansibrightyellow" = yellow;
@ -219,20 +219,20 @@ in
"editor.findMatchHighlightBackground" = "#00000000"; "editor.findMatchHighlightBackground" = "#00000000";
"editor.findMatchHighlightBorder" = "#aaaaaa"; "editor.findMatchHighlightBorder" = "#aaaaaa";
"editor.selectionHighlightBackground" = "#464646"; "editor.selectionHighlightBackground" = "#464646";
"editorError.foreground" = red-dark; "editorError.foreground" = red;
"editorMarkerNavigationError.background" = red-dark; "editorMarkerNavigationError.background" = red-dark;
"editorOverviewRuler.errorForeground" = red-dark; "editorOverviewRuler.errorForeground" = red;
"gitDecoration.conflictingResourceForeground" = red-dark; "gitDecoration.conflictingResourceForeground" = red;
"inputValidation.errorBackground" = red-dark; "inputValidation.errorBackground" = red-dark;
"list.errorForeground" = red-dark; "list.errorForeground" = red;
"list.invalidItemForeground" = red-dark; "list.invalidItemForeground" = red;
"editorBracketHighlight.unexpectedBracket.foreground" = red-dark; "editorBracketHighlight.unexpectedBracket.foreground" = red;
"editorBracketHighlight.foreground1" = teal-alt; "editorBracketHighlight.foreground1" = teal;
"editorBracketHighlight.foreground2" = purple-alt; "editorBracketHighlight.foreground2" = purple;
"editorBracketHighlight.foreground3" = teal-alt; "editorBracketHighlight.foreground3" = teal;
"editorBracketHighlight.foreground4" = purple-alt; "editorBracketHighlight.foreground4" = purple;
"editorBracketHighlight.foreground5" = teal-alt; "editorBracketHighlight.foreground5" = teal;
"editorBracketHighlight.foreground6" = purple-alt; "editorBracketHighlight.foreground6" = purple;
}; };
"editor.tokenColorCustomizations" = { "editor.tokenColorCustomizations" = {
textMateRules = [ textMateRules = [

View file

@ -54,15 +54,15 @@ in
with palette.hex; { with palette.hex; {
file-renamed-label = "moved:"; file-renamed-label = "moved:";
line-numbers-left-format = "{nm:>1} "; line-numbers-left-format = "{nm:>1} ";
line-numbers-left-style = "${gray-dark} bold"; line-numbers-left-style = "${white-dark} bold";
line-numbers-minus-style = "${vermilion-dark} bold"; line-numbers-minus-style = "${vermilion-dark} bold";
line-numbers-plus-style = "${teal-dark} bold"; line-numbers-plus-style = "${teal-dark} bold";
line-numbers-right-format = "{np:>1}"; line-numbers-right-format = "{np:>1}";
line-numbers-right-style = "${gray-dark} bold"; line-numbers-right-style = "${white-dark} bold";
line-numbers-zero-style = "${gray-dark} bold"; line-numbers-zero-style = "${white-dark} bold";
minus-emph-style = "${vermilion-dark-contrast-minimum} ${vermilion-dark}"; minus-emph-style = "${vermilion-dark-contrast-minimum} ${vermilion-dark}";
minus-empty-line-marker-style = "normal ${vermilion-dark}"; minus-empty-line-marker-style = "normal ${vermilion-dark}";
minus-non-emph-style = "${gray} dim"; minus-non-emph-style = "${white-dim} dim";
minus-style = "${vermilion-dark-contrast-minimum} ${vermilion-dark}"; minus-style = "${vermilion-dark-contrast-minimum} ${vermilion-dark}";
plus-emph-style = "syntax ${teal-dark}"; plus-emph-style = "syntax ${teal-dark}";
plus-empty-line-marker-style = "normal ${teal-dark}"; plus-empty-line-marker-style = "normal ${teal-dark}";

View file

@ -108,16 +108,16 @@ in
background = black; background = black;
cursor = orange; cursor = orange;
url_color = white; url_color = white;
active_border_color = gray-dark; active_border_color = white-dark;
inactive_border_color = gray-dark; inactive_border_color = white-dark;
bell_border_color = red; bell_border_color = red;
active_tab_foreground = white; active_tab_foreground = white;
active_tab_background = gray-dark; active_tab_background = white-dark;
inactive_tab_foreground = gray; inactive_tab_foreground = white-dim;
inactive_tab_background = gray-dark; inactive_tab_background = white-dark;
selection_foreground = black; selection_foreground = black;
selection_background = orange; selection_background = orange;
color0 = gray-dark; color0 = white-dark;
color1 = red; color1 = red;
color2 = green; color2 = green;
color3 = yellow; color3 = yellow;
@ -125,7 +125,7 @@ in
color5 = orange; color5 = orange;
color6 = purple; color6 = purple;
color7 = white; color7 = white;
color8 = gray; color8 = white-dim;
color9 = red; color9 = red;
color10 = green; color10 = green;
color11 = yellow; color11 = yellow;

View file

@ -5,13 +5,17 @@ let
inherit (lib) concatLines imap0 mapAttrsRecursive mapAttrsToList nameValuePair; inherit (lib) concatLines imap0 mapAttrsRecursive mapAttrsToList nameValuePair;
inherit (import ./lib.nix { inherit lib; }) oklchToRgb rgbToHex round; inherit (import ./lib.nix { inherit lib; }) oklchToRgb rgbToHex round;
# TODO: Automatically clamp to sRGB
dark = c: c // { l = 0.35; c = if c.c == 0 then 0 else 0.060; };
dim = c: c // { l = 0.50; c = if c.c == 0 then 0 else 0.150; };
contrast-minimum = c: c // { l = c.l + 0.25 * (if c.l < 0.5 then 1 else - 1); };
ansiNames = [ "black" "red" "green" "yellow" "blue" "magenta" "cyan" "white" ]; ansiNames = [ "black" "red" "green" "yellow" "blue" "magenta" "cyan" "white" ];
oklch = rec { oklch = rec {
# Base Monokai # Base Monokai
black = { l = 0.22; c = 0.000; h = 0; }; black = { l = 0.22; c = 0.000; h = 0; };
blue = { l = 0.83; c = 0.108; h = 212; }; 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; }; green = { l = 0.84; c = 0.204; h = 127; };
orange = { l = 0.77; c = 0.168; h = 62; }; orange = { l = 0.77; c = 0.168; h = 62; };
purple = { l = 0.70; c = 0.181; h = 298; }; purple = { l = 0.70; c = 0.181; h = 298; };
@ -24,23 +28,24 @@ let
teal = { l = 0.81; c = 0.152; h = 171; }; teal = { l = 0.81; c = 0.152; h = 171; };
vermilion = { l = 0.68; c = 0.205; h = 36; }; vermilion = { l = 0.68; c = 0.205; h = 36; };
# Alternate # Dim
blue-alt = blue // { l = 0.76; }; blue-dim = dim blue // { c = 0.087; };
green-alt = green // { l = 0.77; c = 0.198; }; green-dim = dim green // { c = 0.128; };
orange-alt = orange // { l = 0.70; c = 0.161; }; orange-dim = dim orange // { c = 0.115; };
purple-alt = purple // { l = 0.64; }; purple-dim = dim purple;
red-alt = red // { l = 0.57; c = 0.217; }; red-dim = dim red;
teal-alt = teal // { l = 0.74; c = 0.144; }; teal-dim = dim teal // { c = 0.097; };
vermilion-alt = vermilion // { l = 0.61; }; vermilion-dim = dim vermilion;
yellow-alt = yellow // { l = 0.81; }; white-dim = dim white;
yellow-dim = dim yellow // { c = 0.105; };
# Dark # Dark
gray-dark = gray // { l = 0.35; }; purple-dark = dark purple;
purple-dark = purple // { l = 0.47; }; red-dark = dark red;
red-dark = red // { l = 0.54; c = 0.216; }; teal-dark = dark teal;
teal-dark = teal // { l = 0.36; c = 0.060; }; vermilion-dark = dark vermilion;
vermilion-dark = vermilion // { l = 0.34; c = 0.060; }; vermilion-dark-contrast-minimum = contrast-minimum vermilion-dark;
vermilion-dark-contrast-minimum = vermilion // { l = 0.60; c = 0.030; }; white-dark = dark white;
}; };
in in
rec { rec {

View file

@ -74,7 +74,7 @@ in
console.font = "ter-v32n"; console.font = "ter-v32n";
console.colors = map (removePrefix "#") (with palette.hex; [ console.colors = map (removePrefix "#") (with palette.hex; [
"#000000" red green yellow blue orange purple platinum "#000000" red green yellow blue orange purple platinum
gray red green yellow blue orange purple white white-dim red green yellow blue orange purple white
]); ]);
# Power # Power