initial commit
All checks were successful
Deploy docs / build-and-deploy (push) Successful in 3s

This commit is contained in:
sid 2026-02-23 20:34:35 +01:00
commit 95a533c876
451 changed files with 18255 additions and 0 deletions

View file

@ -0,0 +1,91 @@
{
inputs,
config,
lib,
pkgs,
...
}:
let
cfg = config.stylix;
# all valid options for `cfg.scheme`
validSchemes = [
"ayu"
"dracula"
"gruvbox"
"moonfly"
"nord"
"oxocarbon"
];
# schemes names in `pkgs.base16-schemes` that need a suffix
needsSuffix = [
"ayu"
"gruvbox"
];
# schemes in ./schemes
customSchemes = [
"moonfly"
"oxocarbon"
];
schemeName =
if builtins.elem cfg.scheme needsSuffix then "${cfg.scheme}-${cfg.polarity}" else cfg.scheme;
scheme =
if builtins.elem cfg.scheme customSchemes then
./schemes/${schemeName}.yaml
else
"${pkgs.base16-schemes}/share/themes/${schemeName}.yaml";
inherit (lib)
mkDefault
mkIf
types
;
in
{
imports = [
inputs.stylix.homeModules.stylix
./targets
];
options.stylix = {
scheme = lib.mkOption {
type = types.str;
default = "dracula";
description = ''
Base16 color scheme name. Available options are:
${toString validSchemes}
'';
};
};
config = mkIf cfg.enable {
assertions = [
{
assertion = builtins.elem cfg.scheme validSchemes;
message = "Stylix: Invalid colorscheme '${cfg.scheme}'. Available options: ${toString validSchemes}";
}
];
stylix = {
autoEnable = mkDefault true;
base16Scheme = scheme;
fonts = {
monospace = mkDefault {
package = pkgs.hack-font;
name = "Hack";
};
};
polarity = mkDefault "dark";
targets = {
librewolf.profileNames = [ "default" ];
};
};
home.packages = [
(pkgs.callPackage ./print-colors { })
];
};
}

View file

@ -0,0 +1,22 @@
{
python3Packages,
...
}:
python3Packages.buildPythonApplication {
pname = "print-colors";
version = "1.0.0";
src = ./.;
pyproject = true;
build-system = [ python3Packages.setuptools ];
propagatedBuildInputs = [ python3Packages.pyyaml ];
doCheck = false;
meta = {
description = "Display colors from a YAML color palette file in the terminal.";
};
}

View file

@ -0,0 +1,81 @@
#!/usr/bin/env python3
import yaml
import argparse
def hex_to_rgb(hex_color):
"""Converts a hex color string (e.g., 'RRGGBB') to an RGB tuple."""
hex_color = hex_color.lstrip('#')
if len(hex_color) != 6:
raise ValueError(f"Invalid hex color format: {hex_color}. Expected 6 characters.")
return tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
def print_color_block(hex_color, label):
"""Prints a colored block with a label using ANSI escape codes."""
try:
r, g, b = hex_to_rgb(hex_color)
except ValueError as e:
print(f"Error converting hex '{hex_color}' for '{label}': {e}")
return
luminosity = (r * 0.2126 + g * 0.7152 + b * 0.0722)
if luminosity > 186:
text_color_code = ";38;2;0;0;0" # black
else:
text_color_code = ";38;2;255;255;255" # white
print(f"\x1b[48;2;{r};{g};{b}{text_color_code}m {label.ljust(15)} \x1b[0m")
def main():
parser = argparse.ArgumentParser(
description="Display colors from a YAML color palette file in the terminal."
)
parser.add_argument(
"yaml_file",
metavar="YAML_FILE",
type=str,
help="Path to the YAML file containing the color palette."
)
args = parser.parse_args()
yaml_file_path = args.yaml_file
try:
with open(yaml_file_path, 'r') as f:
data = yaml.safe_load(f)
except FileNotFoundError:
print(f"Error: '{yaml_file_path}' not found.")
return
except yaml.YAMLError as e:
print(f"Error parsing YAML file '{yaml_file_path}': {e}")
return
except Exception as e:
print(f"An unexpected error occurred while reading '{yaml_file_path}': {e}")
return
system_name = data.get('system', 'N/A')
theme_name = data.get('name', 'N/A')
description = data.get('description', 'N/A')
palette = data.get('palette', {})
print(f"\x1b[1mSystem:\x1b[0m {system_name}")
print(f"\x1b[1mTheme Name:\x1b[0m {theme_name}")
print(f"\x1b[1mDescription:\x1b[0m {description}\n")
print("\x1b[1mPalette Colors:\x1b[0m")
sorted_palette_keys = sorted(palette.keys(), key=lambda x: (x.startswith('base'), x))
for key in sorted_palette_keys:
hex_color = palette.get(key)
if hex_color:
print_color_block(hex_color, key)
else:
print(f"Warning: Key '{key}' has no hexadecimal color value.")
if __name__ == "__main__":
main()

View file

@ -0,0 +1,7 @@
from setuptools import setup
setup(
name='print-colors',
version='1.0.0',
scripts=['print-colors'],
)

View file

@ -0,0 +1,22 @@
system: "base16"
name: "Moonfly"
description: "A dark theme inspired by the Moonfly color scheme."
slug: "moonfly-theme"
variant: "dark"
palette:
base00: "080808"
base01: "323437"
base02: "9e9e9e"
base03: "bdbdbd"
base04: "b2ceee"
base05: "c6c6c6"
base06: "e4e4e4"
base07: "eeeeee"
base08: "ff5454"
base09: "cf87e8"
base0A: "8cc85f"
base0B: "e3c78a"
base0C: "79dac8"
base0D: "80a0ff"
base0E: "36c692"
base0F: "74b2ff"

View file

@ -0,0 +1,22 @@
system: "base16"
name: "Oxocarbon"
description: "A dark theme inspired by the Oxocarbon Dark color scheme."
slug: "oxocarbon-theme"
variant: "dark"
palette:
base00: "161616"
base01: "262626"
base02: "393939"
base03: "525252"
base04: "dde1e6"
base05: "f2f4f8"
base06: "ffffff"
base07: "08bdba"
base08: "ee5396"
base09: "ff7eb6"
base0A: "3ddbd9"
base0B: "42be65"
base0C: "82cfff"
base0D: "33b1ff"
base0E: "be95ff"
base0F: "78a9ff"

View file

@ -0,0 +1,55 @@
{ config, lib, ... }:
let
cfg = config.stylix;
target = cfg.targets.bemenu';
colors = config.lib.stylix.colors.withHashtag;
inherit (lib)
mkEnableOption
mkIf
mkOption
types
;
in
{
options.stylix.targets.bemenu' = {
enable = mkEnableOption "bemenu' target for Stylix.";
radius = mkOption {
type = types.int;
default = cfg.targets.hyprland.radius;
description = "Window corner radius in pixels.";
};
};
config = mkIf (cfg.enable && target.enable) {
stylix.targets.bemenu.enable = false;
programs.bemenu = mkIf (cfg.enable && target.enable) {
settings = {
border-radius = target.radius;
bdr = colors.blue; # Border
tb = colors.base00; # Title background
tf = colors.green; # Title foreground
fb = colors.base00; # Filter background
ff = colors.base05; # Filter foreground
cb = colors.base00; # Cursor background
cf = colors.base02; # Cursor foreground
nb = colors.base00; # Normal background
nf = colors.base05; # Normal foreground
hb = colors.base01; # Highlighted background
hf = colors.blue; # Highlighted foreground
fbb = colors.base00; # Feedback background
fbf = colors.base05; # Feedback foreground
sb = colors.base01; # Selected background
sf = colors.base05; # Selected foreground
ab = colors.base00; # Alternating background
af = colors.base05; # Alternating foreground
scb = colors.base00; # Scrollbar background
scf = colors.blue; # Scrollbar foreground
};
};
};
}

View file

@ -0,0 +1,8 @@
{
imports = [
./bemenu.nix
./hyprland.nix
./nixvim.nix
./waybar.nix
];
}

View file

@ -0,0 +1,40 @@
{ config, lib, ... }:
let
cfg = config.stylix;
target = cfg.targets.hyprland;
inherit (lib)
mkIf
mkOption
types
;
in
{
options.stylix.targets.hyprland = {
gaps = mkOption {
type = types.int;
default = 0;
description = "Window gaps in pixels.";
};
radius = mkOption {
type = types.int;
default = 0;
description = "Window corner radius in pixels.";
};
};
config = mkIf (cfg.enable && target.enable) {
wayland.windowManager.hyprland = {
settings = {
general = {
gaps_in = target.gaps / 2;
gaps_out = target.gaps;
};
decoration = {
rounding = target.radius;
};
};
};
};
}

View file

@ -0,0 +1,14 @@
{ config, lib, ... }:
let
cfg = config.stylix;
target = cfg.targets.nixvim;
inherit (lib) mkIf;
in
{
config = mkIf cfg.enable {
stylix.targets.nixvim.enable = false;
programs.nixvim.colorschemes."${cfg.scheme}".enable = !target.enable;
};
}

View file

@ -0,0 +1,130 @@
{ config, lib, ... }:
let
cfg = config.stylix;
target = cfg.targets.waybar';
colors = config.lib.stylix.colors.withHashtag;
gaps = toString (4 + target.gaps);
halfgaps = toString (2 + target.gaps / 2);
radius = toString target.radius;
bar = {
margin = "0 ${gaps} 0 ${gaps}";
tray = {
spacing = target.gaps;
};
# calendar has no css
clock.calendar.format = {
months = "<span color='${colors.blue}'><b>{}</b></span>";
weeks = "<span color='${colors.magenta}'><b>W{}</b></span>";
weekdays = "<span color='${colors.green}'><b>{}</b></span>";
today = "<span color='${colors.red}'><b><u>{}</u></b></span>";
};
};
inherit (lib)
mkEnableOption
mkIf
mkOption
types
;
in
{
options.stylix.targets.waybar' = {
enable = mkEnableOption "waybar' target for Stylix.";
gaps = mkOption {
type = types.int;
default = cfg.targets.hyprland.gaps;
description = "Widget gaps in pixels.";
};
radius = mkOption {
type = types.int;
default = cfg.targets.hyprland.radius;
description = "Widget corner radius in pixels.";
};
};
config = mkIf (cfg.enable && target.enable) {
stylix.targets.waybar.enable = false;
programs.waybar = {
settings = {
mainBar = bar;
otherBar = bar;
};
style = ''
* {
border-radius: ${radius}px;
border: none;
font-family: monospace;
font-size: 15px;
min-height: 5px;
transition: none;
}
window#waybar {
background: transparent;
}
#workspaces {
color: ${colors.base05};
background: ${colors.base00};
}
#workspaces button {
padding: ${halfgaps}px;
}
#workspaces button.active {
color: ${colors.blue};
}
#workspaces button.urgent {
color: ${colors.orange};
}
#workspaces button:hover {
color: ${colors.base00};
background: ${colors.base02};
}
#clock {
padding: ${gaps}px;
}
#cpu, #memory, #network, #battery, #keyboard-state, #disk, #bluetooth, #wireplumber, #pulseaudio, #language, #custom-newsboat, #custom-timer, #tray {
margin-left: ${gaps}px;
padding: ${gaps}px;
}
#keyboard-state label.locked {
background-color: ${colors.base00};
color: ${colors.blue};
}
#battery.charging {
background-color: ${colors.green};
color: ${colors.base00};
}
#battery.warning:not(.charging) {
background-color: ${colors.yellow};
color: ${colors.base00};
}
#battery.critical:not(.charging) {
background-color: ${colors.red};
color: ${colors.base00};
}
#bluetooth.discovering {
background-color: ${colors.blue};
color: ${colors.base00};
}
'';
};
};
}