From f8413fd424be064ffaa2fb21264ff18edc42afc3 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sat, 22 Jun 2024 18:31:31 +0200 Subject: Switch to gruvbox and add ability to use light and dark mode --- alacritty/alacritty.toml | 35 +---------------------------------- alacritty/colors-dark.toml | 28 ++++++++++++++++++++++++++++ alacritty/colors-light.toml | 28 ++++++++++++++++++++++++++++ alacritty/default.nix | 21 ++++++++++++++++----- awesome/rc.lua | 5 ++++- default.nix | 1 + 6 files changed, 78 insertions(+), 40 deletions(-) create mode 100644 alacritty/colors-dark.toml create mode 100644 alacritty/colors-light.toml diff --git a/alacritty/alacritty.toml b/alacritty/alacritty.toml index edef4a7..ea60335 100644 --- a/alacritty/alacritty.toml +++ b/alacritty/alacritty.toml @@ -1,6 +1,6 @@ # https://alacritty.org/config-alacritty.html -import = [ "$HINTS_FILE" ] +import = [ "$HINTS_FILE", "$COLORS_FILE" ] [window] decorations = "None" @@ -8,36 +8,3 @@ decorations = "None" [font] normal = { family = "Source Code Pro", style = "Normal" } size = 6.3 - -# Colors (PaperColor - Light) - -# Default colors -[colors.primary] -background = '#eeeeee' -foreground = '#444444' - -[colors.cursor] -text = '#eeeeee' -cursor = '#444444' - -# Normal colors -[colors.normal] -black = '#eeeeee' -red = '#af0000' -green = '#008700' -yellow = '#5f8700' -blue = '#0087af' -magenta = '#878787' -cyan = '#005f87' -white = '#444444' - -# Bright colors -[colors.bright] -black = '#bcbcbc' -red = '#d70000' -green = '#d70087' -yellow = '#8700af' -blue = '#d75f00' -magenta = '#d75f00' -cyan = '#005faf' -white = '#005f87' diff --git a/alacritty/colors-dark.toml b/alacritty/colors-dark.toml new file mode 100644 index 0000000..f9fb56d --- /dev/null +++ b/alacritty/colors-dark.toml @@ -0,0 +1,28 @@ +# Colors (Gruvbox Material Hard Dark) + +# Default colors +[colors.primary] +background = '#1d2021' +foreground = '#d4be98' + +# Normal colors +[colors.normal] +black = '#32302f' +red = '#ea6962' +green = '#a9b665' +yellow = '#d8a657' +blue = '#7daea3' +magenta = '#d3869b' +cyan = '#89b482' +white = '#d4be98' + +# Bright colors (same as normal colors) +[colors.bright] +black = '#32302f' +red = '#ea6962' +green = '#a9b665' +yellow = '#d8a657' +blue = '#7daea3' +magenta = '#d3869b' +cyan = '#89b482' +white = '#d4be98' diff --git a/alacritty/colors-light.toml b/alacritty/colors-light.toml new file mode 100644 index 0000000..e17ebdf --- /dev/null +++ b/alacritty/colors-light.toml @@ -0,0 +1,28 @@ +# Colors (Gruvbox Material Hard Light) + +# Default colors +[colors.primary] +background = '#f9f5d7' +foreground = '#654735' + +# Normal colors +[colors.normal] +black = '#654735' +red = '#c14a4a' +green = '#6c782e' +yellow = '#b47109' +blue = '#45707a' +magenta = '#945e80' +cyan = '#4c7a5d' +white = '#f2e5bc' + +# Bright colors (same as normal colors) +[colors.bright] +black = '#654735' +red = '#c14a4a' +green = '#6c782e' +yellow = '#b47109' +blue = '#45707a' +magenta = '#945e80' +cyan = '#4c7a5d' +white = '#f2e5bc' diff --git a/alacritty/default.nix b/alacritty/default.nix index 9350884..40d7074 100644 --- a/alacritty/default.nix +++ b/alacritty/default.nix @@ -43,10 +43,12 @@ hintsFile = (pkgs.formats.toml {}).generate "alacritty-hints.toml" hintsFileBody; - configFile = pkgs.writeText "alacritty-config" ( + configFile = { + colorsFile, + }: pkgs.writeText "alacritty-config" ( builtins.replaceStrings - ["$HINTS_FILE"] - ["${hintsFile}"] + ["$HINTS_FILE" "$COLORS_FILE"] + ["${hintsFile}" "${colorsFile}"] (builtins.readFile ./alacritty.toml) ); @@ -54,7 +56,10 @@ exec ${alacrittyUnwrap} "${zsh}/bin/zsh" "$@" ''; - alacritty = pkgs.writeShellScriptBin "alacritty" '' + mkAlacritty = { + name ? "alacritty", + colorsFile ? ./colors-dark.toml, + }: pkgs.writeShellScriptBin name '' set -e -x source "${pkgs.ldUtils}" @@ -82,7 +87,13 @@ exec ${pkgs.alacritty}/bin/alacritty \ -o font.size=${builtins.toString config.alacritty.fontSize} \ - --config-file ${configFile} \ + --config-file ${configFile { inherit colorsFile; }} \ -e "${shellEntrypoint}" ''; + + alacritty = mkAlacritty {}; + alacrittyLight = mkAlacritty { + name = "alacritty-light"; + colorsFile = ./colors-light.toml; + }; } diff --git a/awesome/rc.lua b/awesome/rc.lua index 5cb6c7f..e3a3cba 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -84,7 +84,6 @@ beautiful.init(theme) terminal = "alacritty" editor = os.getenv("EDITOR") or "nano" -editor_cmd = terminal .. " -e " .. editor -- Default modkey. -- Usually, Mod4 is the key with a logo between Control and Alt. @@ -325,6 +324,10 @@ globalkeys = awful.util.table.join( awful.spawn(terminal) end), + awful.key({ modkey, "Shift" }, "Return", function () + awful.spawn("alacritty-light") + end), + --PrintScreen awful.key({}, "Print", false, function () awful.spawn(bin_dir.."scrot.sh",false) end), awful.key({ "Control" }, "Print", function () diff --git a/default.nix b/default.nix index 5018614..80dd405 100644 --- a/default.nix +++ b/default.nix @@ -161,6 +161,7 @@ in rec { ((import ./nvim) {}).nvim zsh ((import ./alacritty) { inherit config zsh; }).alacritty + ((import ./alacritty) { inherit config zsh; }).alacrittyLight awesome.env ]; }; -- cgit v1.2.3