Skip to content

Commit 3c286df

Browse files
committed
stylix/testbeds/themes: overhaul testbed themes for broader coverage
1 parent e698150 commit 3c286df

File tree

12 files changed

+207
-110
lines changed

12 files changed

+207
-110
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ philosophy.
4040
Try a live demo of this dark theme by running:
4141

4242
```console
43-
nix run github:nix-community/stylix#testbed:gnome:dark
43+
nix run github:nix-community/stylix#testbed:gnome:full-dark
4444
```
4545

4646
### KDE Plasma 5

doc/src/testbeds.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,16 @@ github:nix-community/stylix
7777
└───x86_64-linux
7878
├───doc: package 'stylix-book'
7979
├───palette-generator: package 'palette-generator'
80-
├───"testbed:gnome:cursorless": package 'testbed-gnome-cursorless'
81-
├───"testbed:gnome:dark": package 'testbed-gnome-dark'
82-
├───"testbed:gnome:imageless": package 'testbed-gnome-imageless'
83-
├───"testbed:gnome:light": package 'testbed-gnome-light'
84-
├───"testbed:gnome:schemeless": package 'testbed-gnome-schemeless'
85-
├───"testbed:kde:cursorless": package 'testbed-kde-cursorless'
86-
├───"testbed:kde:dark": package 'testbed-kde-dark'
87-
├───"testbed:kde:imageless": package 'testbed-kde-imageless'
88-
├───"testbed:kde:light": package 'testbed-kde-light'
89-
└───"testbed:kde:schemeless": package 'testbed-kde-schemeless'
80+
├───"testbed:gnome:default": package 'testbed-gnome-default'
81+
├───"testbed:gnome:disabled": package 'testbed-gnome-disabled'
82+
├───"testbed:gnome:empty": package 'testbed-gnome-empty'
83+
├───"testbed:gnome:full-dark": package 'testbed-gnome-full-dark'
84+
├───"testbed:gnome:partial-light": package 'testbed-gnome-partial-light'
85+
├───"testbed:kde:default": package 'testbed-kde-default'
86+
├───"testbed:kde:disabled": package 'testbed-kde-disabled'
87+
├───"testbed:kde:empty": package 'testbed-kde-empty'
88+
├───"testbed:kde:full-dark": package 'testbed-kde-full-dark'
89+
└───"testbed:kde:partial-light": package 'testbed-kde-partial-light'
9090
```
9191

9292
(This has been edited down to only the relevant parts.)

stylix/testbed/images.nix

Lines changed: 0 additions & 30 deletions
This file was deleted.

stylix/testbed/themes/dark.nix

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1+
# Test the default Stylix configuration.
12
{ pkgs, ... }:
2-
let
3-
images = pkgs.callPackages ../images.nix { };
4-
in
53
{
64
stylix = {
7-
enable = true;
8-
image = images.dark;
95
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-macchiato.yaml";
10-
polarity = "dark";
6+
enable = true;
117
};
128
}

stylix/testbed/themes/disabled.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Test Stylix being disabled.
2+
{ stylix.enable = false; }

stylix/testbed/themes/empty.nix

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Test Stylix being enabled with all its features disabled.
2+
{
3+
config,
4+
lib,
5+
pkgs,
6+
...
7+
}:
8+
{
9+
stylix = {
10+
enable = true;
11+
icons.enable = false;
12+
overlays.enable = false;
13+
14+
# TODO: Disable the color functionality by replacing the mandatory
15+
# stylix.base16Scheme declaration with 'stylix.colors.enable = false;' once
16+
# this option is implemented.
17+
base16Scheme = "${pkgs.base16-schemes}/share/themes/mellow-purple.yaml";
18+
19+
# TODO: Properly disable the cursor functionality by replacing the
20+
# stylix.cursor declaration with 'stylix.cursor.enable = false;' once this
21+
# option is implemented.
22+
cursor = null;
23+
24+
# TODO: Disable the font functionality with 'stylix.fonts.enable = false;'
25+
# once this option is implemented.
26+
27+
# TODO: Properly disable the image functionality by replacing the
28+
# stylix.image declaration with 'stylix.image.enable = false;' once this
29+
# option is implemented. The stylix.image.enable namespace is subject to
30+
# change.
31+
image = null;
32+
33+
# TODO: Properly disable the opacity functionality by replacing the
34+
# stylix.opacity declaration with 'stylix.opacity.enable = false;' once this
35+
# option is implemented.
36+
opacity = lib.genAttrs (builtins.attrNames config.stylix.opacity) (_: 1.0);
37+
};
38+
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Test a complete Stylix configuration with a dark theme, image, and all options
2+
# set to non-default values.
3+
{
4+
config,
5+
lib,
6+
pkgs,
7+
...
8+
}:
9+
{
10+
stylix = {
11+
enable = true;
12+
13+
# TODO: Declare different dark and light themes after resolving [1].
14+
#
15+
# [1]: https://github.com/nix-community/stylix/issues/1855
16+
icons = {
17+
dark = "Adwaita";
18+
enable = true;
19+
light = "Adwaita";
20+
package = pkgs.adwaita-icon-theme;
21+
};
22+
23+
overlays.enable = true;
24+
polarity = "dark";
25+
26+
override =
27+
{
28+
author = "Stylix";
29+
scheme = "Catppuccin Macchiato and Mocha";
30+
slug = "catppuccin-macchiato-and-mocha";
31+
}
32+
// lib.importJSON (
33+
pkgs.runCommand "catppuccin-macchiato-and-mocha.json"
34+
{
35+
nativeBuildInputs = [ pkgs.yq-go ];
36+
src = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml";
37+
}
38+
''
39+
yq \
40+
--output-format json \
41+
'
42+
.palette |
43+
with_entries(select(.key | test("^base0(1|3|5|7|9|B|D|F)$")))
44+
' \
45+
<"$src" \
46+
>"$out"
47+
''
48+
);
49+
50+
# TODO: Explicitly enable the color functionality with 'stylix.colors.enable
51+
# = true;' once this option is implemented.
52+
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-macchiato.yaml";
53+
54+
cursor = {
55+
name = "Bibata-Modern-Amber";
56+
package = pkgs.bibata-cursors;
57+
size = 25;
58+
};
59+
60+
fonts = {
61+
# TODO: Since this declaration is the default stylix.fonts.emoji value,
62+
# the default value or this declaration should be changed.
63+
emoji = {
64+
name = "Noto Color Emoji";
65+
package = pkgs.noto-fonts-color-emoji;
66+
};
67+
68+
monospace = {
69+
name = "Fira Code";
70+
package = pkgs.fira-code;
71+
};
72+
73+
sansSerif = {
74+
name = "Noto Sans";
75+
package = pkgs.noto-fonts;
76+
};
77+
78+
serif = {
79+
name = "Noto Serif";
80+
package = pkgs.noto-fonts;
81+
};
82+
83+
sizes = lib.genAttrs (builtins.attrNames config.stylix.fonts.sizes) (_: 14);
84+
};
85+
86+
# Test path containing special characters.
87+
image =
88+
let
89+
file = "${
90+
lib.pipe "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" [
91+
lib.stringToCharacters
92+
(builtins.concatStringsSep " ")
93+
]
94+
}.jpg";
95+
in
96+
"${
97+
pkgs.runCommandLocal "image-path-containing-special-characters"
98+
{
99+
src = pkgs.fetchurl {
100+
hash = "sha256-Dm/0nKiTFOzNtSiARnVg7zM0J1o+EuIdUQ3OAuasM58=";
101+
name = "image.jpg";
102+
url = "https://unsplash.com/photos/ZqLeQDjY6fY/download";
103+
};
104+
}
105+
''
106+
mkdir "$out"
107+
cp "$src" "$out"/${lib.escapeShellArg file}
108+
''
109+
}/${file}";
110+
111+
opacity = lib.genAttrs (builtins.attrNames config.stylix.opacity) (_: 0.8);
112+
};
113+
}

stylix/testbed/themes/imageless.nix

Lines changed: 0 additions & 13 deletions
This file was deleted.

stylix/testbed/themes/light.nix

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)