Skip to content

Commit

Permalink
Try out OK Solar colorpalette
Browse files Browse the repository at this point in the history
  • Loading branch information
malob committed Dec 28, 2024
1 parent 04a974e commit 8e55044
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 54 deletions.
2 changes: 1 addition & 1 deletion configs/nvim/lua/lush_theme/malo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local c = require'malo.theme'.colors
-- Function to set/update colors that are dependant on `vim.o.background`
local function choose(dark, light) return vim.o.background == 'dark' and dark or light end
local function highlight(color)
return vim.o.background == 'dark' and color.lightness(20) or color.lightness(80)
return vim.o.background == 'dark' and color.darken(50) or color.lighten(50)
end

---@diagnostic disable: undefined-global
Expand Down
34 changes: 17 additions & 17 deletions configs/nvim/lua/malo/theme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
-- Still early days, with lots of work needed
-- https://github.com/rktjmp/lush.nvim
local lush = require 'lush'
local hsl = lush.hsl
local hsluv = lush.hsluv
local seq = require 'pl.seq'

local M = {}

-- Default colors are the Solarized colors
M.colors = {
darkBase = hsl '#002b36', -- base03
darkBaseHl = hsl '#073642', -- base02
darkestTone = hsl '#586e75', -- base01
darkTone = hsl '#657b83', -- base00
lightTone = hsl '#839496', -- base0
lightestTone = hsl '#93a1a1', -- base1
lightBaseHl = hsl '#eee8d5', -- base2
lightBase = hsl '#fdf6e3', -- base3
yellow = hsl '#b58900',
orange = hsl '#cb4b16',
red = hsl '#dc322f',
magenta = hsl '#d33682',
violet = hsl '#6c71c4',
blue = hsl '#268bd2',
cyan = hsl '#2aa198',
green = hsl '#859900',
darkBase = hsluv (vim.g.theme_base03 or '#002b36'),
darkBaseHl = hsluv (vim.g.theme_base02 or '#073642'),
darkestTone = hsluv (vim.g.theme_base01 or '#586e75'),
darkTone = hsluv (vim.g.theme_base00 or '#657b83'),
lightTone = hsluv (vim.g.theme_base0 or '#839496'),
lightestTone = hsluv (vim.g.theme_base1 or '#93a1a1'),
lightBaseHl = hsluv (vim.g.theme_base2 or '#eee8d5'),
lightBase = hsluv (vim.g.theme_base3 or '#fdf6e3'),
yellow = hsluv (vim.g.theme_yellow or '#b58900'),
orange = hsluv (vim.g.theme_orange or '#cb4b16'),
red = hsluv (vim.g.theme_red or '#dc322f'),
magenta = hsluv (vim.g.theme_magenta or '#d33682'),
violet = hsluv (vim.g.theme_violet or '#6c71c4'),
blue = hsluv (vim.g.theme_blue or '#268bd2'),
cyan = hsluv (vim.g.theme_cyan or '#2aa198'),
green = hsluv (vim.g.theme_green or '#859900'),
}

-- A table of strings with the name of additonal Lush specs that should be merged with the
Expand Down
5 changes: 3 additions & 2 deletions darwin/homebrew.nix
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ in
};

# Hack: https://github.com/ghostty-org/ghostty/discussions/2832
environment.variables.XDG_DATA_DIRS =
mkIf (caskPresent "ghostty") ["$GHOSTTY_SHELL_INTEGRATION_XDG_DIR"];
environment.variables.XDG_DATA_DIRS = mkIf (caskPresent "ghostty") [
"$GHOSTTY_SHELL_INTEGRATION_XDG_DIR"
];

# For cli packages that aren't currently available for macOS in `nixpkgs`. Packages should be
# installed in `../home/packages.nix` whenever possible.
Expand Down
140 changes: 115 additions & 25 deletions home/colors.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Colors from: https://ethanschoonover.com/solarized
# Colors from: https://ethanschoonover.com/solarized ----------------------------------------------

# SOLARIZED HEX 16/8 TERMCOL XTERM/HEX L*A*B RGB HSB
# --------- ------- ---- ------- ----------- ---------- ----------- -----------
Expand All @@ -19,29 +19,30 @@
# cyan #2aa198 6/6 cyan 37 #00afaf 60 -35 -05 42 161 152 175 74 63
# green #859900 2/2 green 64 #5f8700 60 -20 65 133 153 0 68 100 60

{ config, ... }:
# Colors from: https://meat.io/oksolar ------------------------------------------------------------

{
colors.solarized-light = {
colors = {
color0 = "#073642";
color1 = "#dc322f";
color2 = "#859900";
color3 = "#b58900";
color4 = "#268bd2";
color5 = "#d33682";
color6 = "#2aa198";
color7 = "#eee8d5";
color8 = "#002b36";
color9 = "#cb4b16";
color10 = "#586e75";
color11 = "#657b83";
color12 = "#839496";
color13 = "#6c71c4";
color14 = "#93a1a1";
color15 = "#fdf6e3";
};
# Name OK Lightness Chrome Hue Hex
# base03 27.4% 0.05 219.6 #002d38
# base02 32.1% 0.053 219.6 #093946
# base01 53.5% 0.029 219.6 #5b7279
# base00 54.4% 0.017 219.6 #657377
# base0 71.8% 0.017 198 #98a8a8
# base1 71.8% 0.03 198 #8faaab
# base2 93.4% 0.031 90 #f1e9d2
# base3 97.7% 0.012 90 #fbf7ef
# yellow 63.1% 0.129 86.4 #ac8300
# orange 63.1% 0.166 50.4 #d56500
# red 63.1% 0.221 21.6 #f23749
# magenta 63.1% 0.205 349.2 #dd459d
# violet 63.1% 0.121 280.8 #7d80d1
# blue 63.1% 0.141 244.8 #2b90d8
# cyan 63.1% 0.102 187.2 #259d94
# green 63.1% 0.148 118.8 #819500

{ config, ... }:

let
commonLight = {
namedColors = {
# Solarized names
base03 = "color8";
Expand Down Expand Up @@ -81,8 +82,8 @@
};
};

colors.solarized-dark = {
inherit (config.colors.solarized-light) colors namedColors;
commonDark = {
inherit (commonLight) namedColors;

terminal = {
bg = "base03";
Expand All @@ -94,7 +95,7 @@
};

pkgThemes.kitty = {
inherit (config.colors.solarized-light.pkgThemes.kitty)
inherit (commonLight.pkgThemes.kitty)
url_color
active_tab_background
active_tab_foreground
Expand All @@ -105,4 +106,93 @@
inactive_tab_foreground = "base1";
};
};
in

{
colors.solarized-light = {
colors = {
color0 = "#073642";
color1 = "#dc322f";
color2 = "#859900";
color3 = "#b58900";
color4 = "#268bd2";
color5 = "#d33682";
color6 = "#2aa198";
color7 = "#eee8d5";
color8 = "#002b36";
color9 = "#cb4b16";
color10 = "#586e75";
color11 = "#657b83";
color12 = "#839496";
color13 = "#6c71c4";
color14 = "#93a1a1";
color15 = "#fdf6e3";
};

inherit (commonLight) namedColors terminal pkgThemes;
};

colors.solarized-dark = {
inherit (config.colors.solarized-light) colors;

inherit (commonDark) namedColors terminal pkgThemes;
};

colors.ok-solar-light = {
colors = {
color0 = "#093946";
color1 = "#f23749";
color2 = "#819500";
color3 = "#ac8300";
color4 = "#2b90d8";
color5 = "#dd459d";
color6 = "#259d94";
color7 = "#f1e9d2";
color8 = "#002d38";
color9 = "#d56500";
color10 = "#5b7279";
color11 = "#657377";
color12 = "#98a8a8";
color13 = "#7d80d1";
color14 = "#8faaab";
color15 = "#fbf7ef";
};

inherit (commonLight) namedColors terminal pkgThemes;
};

colors.ok-solar-dark = {
inherit (config.colors.ok-solar-light) colors;

inherit (commonDark) namedColors terminal pkgThemes;
};

colors.malo-ok-solar-light = {
colors = {
color0 = "#093946";
color1 = "#f23749";
color2 = "#819500";
color3 = "#ac8300";
color4 = "#2b90d8";
color5 = "#dd459d";
color6 = "#259d94";
color7 = "#ece9e0"; # changed chroma to 0.012 to match base3
color8 = "#002d38";
color9 = "#d56500";
color10 = "#5b7279";
color11 = "#657377";
color12 = "#98a8a8";
color13 = "#7d80d1";
color14 = "#8faaab";
color15 = "#fbf7ef";
};

inherit (commonLight) namedColors terminal pkgThemes;
};

colors.malo-ok-solar-dark = {
inherit (config.colors.malo-ok-solar-light) colors;

inherit (commonDark) namedColors terminal pkgThemes;
};
}
14 changes: 7 additions & 7 deletions home/ghostty.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ let
in

{
xdg.configFile."ghostty/themes/Solarized Light".text =
mkThemeConfig config.colors.solarized-light.pkgThemes.ghostty;
xdg.configFile."ghostty/themes/light".text =
mkThemeConfig config.colors.malo-ok-solar-light.pkgThemes.ghostty;

xdg.configFile."ghostty/themes/Solarized Dark".text =
mkThemeConfig config.colors.solarized-dark.pkgThemes.ghostty;
xdg.configFile."ghostty/themes/dark".text =
mkThemeConfig config.colors.malo-ok-solar-dark.pkgThemes.ghostty;

xdg.configFile."ghostty/config".text = toKeyValue { mkKeyValue = mkKeyValueDefault { } " = "; } {
font-family = "PragmataPro Liga";
Expand All @@ -27,11 +27,11 @@ in
adjust-box-thickness = "100%";
adjust-underline-thickness = "400%";

theme = "light:Solarized Light,dark:Solarized Dark";
theme = "light:light,dark:dark";
window-theme = "system";
window-colorspace = "display-p3";
background-opacity = 0.9;
background-blur-radius = 20;
# background-opacity = 0.9;
# background-blur-radius = 20;
window-padding-x = 10;
window-padding-y = 10;

Expand Down
18 changes: 16 additions & 2 deletions home/neovim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
}:
# Let-In ----------------------------------------------------------------------------------------{{{
let
inherit (lib) attrValues concatStringsSep optional;
inherit (lib)
attrValues
concatStringsSep
mapAttrsToList
optional
removePrefix
;
inherit (config.lib.file) mkOutOfStoreSymlink;
inherit (config.home.user-info) nixConfigDirectory;

Expand Down Expand Up @@ -103,6 +109,9 @@ let
++ optional (autoload && configFinal != "") configFinal
));
};

mkVimColorVariable = k: v: ''let g:theme_${k} = "${v}"'';
colorSetToVimscript = colors: concatStringsSep "\n" (mapAttrsToList mkVimColorVariable colors);
in
# }}}
{
Expand All @@ -119,7 +128,12 @@ in
mkOutOfStoreSymlink "${nixConfigDirectory}/configs/nvim/colors";

# Load the `init` module from the above configs
programs.neovim.extraConfig = "lua require('init')";
programs.neovim.extraConfig = ''
${colorSetToVimscript config.colors.malo-ok-solar-light.colors}
${colorSetToVimscript config.colors.malo-ok-solar-light.namedColors}
lua require('init')
'';

# Add `penlight` Lua module package since I used in the above configs
programs.neovim.extraLuaPackages = ps: [ ps.penlight ];
Expand Down

0 comments on commit 8e55044

Please sign in to comment.