Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions doc/src/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,26 @@ To set a wallpaper, provide a path or an arbitrary derivation:
```

If `stylix.base16Scheme` is undeclared, Stylix generates a color scheme based on
the wallpaper using a [genetic
algorithm](https://en.wikipedia.org/wiki/Genetic_algorithm). Note that more
colorful images tend to yield better results. The algorithm's polarity can be
schewed towards a dark or light theme with:
the wallpaper using [Matugen](https://github.com/InioX/matugen). Note that more
colorful images tend to yield better results.

Set the polarity with:

- ```nix
{
stylix.polarity = "dark";
stylix.colorGeneration.polarity = "dark";
}
```

- ```nix
{
stylix.polarity = "light";
stylix.colorGeneration.polarity = "light";
}
```

Customize the generated color scheme with the `stylix.colorGeneration.scheme`
and `stylix.colorGeneration.contrast` options.

The generated color scheme can be viewed at `/etc/stylix/palette.html` on NixOS,
or at `~/.config/stylix/palette.html` on Home Manager.

Expand Down
1 change: 0 additions & 1 deletion doc/src/testbeds.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ github:nix-community/stylix
└───packages
└───x86_64-linux
├───doc: package 'stylix-book'
├───palette-generator: package 'palette-generator'
├───"testbed:gnome:cursorless": package 'testbed-gnome-cursorless'
├───"testbed:gnome:dark": package 'testbed-gnome-dark'
├───"testbed:gnome:imageless": package 'testbed-gnome-imageless'
Expand Down
29 changes: 11 additions & 18 deletions flake/dev/dev-shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,19 @@
'';
in
{
devShells = {
default = pkgs.mkShell {
# Install git-hooks when activating the shell
shellHook = config.pre-commit.installationScript;
devShells.default = pkgs.mkShell {
# Install git-hooks when activating the shell
shellHook = config.pre-commit.installationScript;

packages = [
stylix-check
build-and-run-docs
inputs'.home-manager.packages.default
config.formatter
]
++ config.pre-commit.settings.enabledPackages;
packages = [
stylix-check
build-and-run-docs
inputs'.home-manager.packages.default
config.formatter
]
++ config.pre-commit.settings.enabledPackages;

inputsFrom = [ config.treefmt.build.devShell ];
};

ghc = pkgs.mkShell {
inputsFrom = [ config.devShells.default ];
packages = [ pkgs.ghc ];
};
inputsFrom = [ config.treefmt.build.devShell ];
};
};
}
8 changes: 0 additions & 8 deletions flake/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
{
stylix = {
inherit inputs;
paletteGenerator =
self.packages.${pkgs.stdenv.hostPlatform.system}.palette-generator;
base16 = inputs.base16.lib args;
homeManagerIntegration.module = self.homeModules.stylix;
};
Expand All @@ -31,8 +29,6 @@
{
stylix = {
inherit inputs;
paletteGenerator =
self.packages.${pkgs.stdenv.hostPlatform.system}.palette-generator;
base16 = inputs.base16.lib args;
};
}
Expand All @@ -50,8 +46,6 @@
{
stylix = {
inherit inputs;
paletteGenerator =
self.packages.${pkgs.stdenv.hostPlatform.system}.palette-generator;
base16 = inputs.base16.lib args;
homeManagerIntegration.module = self.homeModules.stylix;
};
Expand All @@ -69,8 +63,6 @@
../stylix/droid
{
stylix = {
paletteGenerator =
self.packages.${pkgs.stdenv.hostPlatform.system}.palette-generator;
base16 = inputs.base16.lib args;
homeManagerIntegration.module = self.homeModules.stylix;
};
Expand Down
1 change: 0 additions & 1 deletion flake/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
serve-docs = pkgs.callPackage ../doc/server.nix {
inherit (config.packages) doc;
};
palette-generator = pkgs.callPackage ../palette-generator { };
};
};
}
4 changes: 2 additions & 2 deletions modules/fnott/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ mkTarget {
}
)
(
{ polarity, icons }:
{ colorGeneration, icons }:
{
services.fnott.settings.main."icon-theme" =
if (polarity == "dark") then icons.dark else icons.light;
if (colorGeneration.polarity == "dark") then icons.dark else icons.light;
}
)
];
Expand Down
4 changes: 2 additions & 2 deletions modules/fuzzel/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ mkTarget {
}
)
(
{ polarity, icons }:
{ colorGeneration, icons }:
{
programs.fuzzel.settings.main."icon-theme" =
if (polarity == "dark") then icons.dark else icons.light;
if (colorGeneration.polarity == "dark") then icons.dark else icons.light;
}
)
];
Expand Down
4 changes: 2 additions & 2 deletions modules/glance/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ mkTarget {

configElements = [
(
{ polarity }:
{ colorGeneration }:
{
services.glance.settings.theme.light = polarity == "light";
services.glance.settings.theme.light = colorGeneration.polarity == "light";
}
)
(
Expand Down
4 changes: 2 additions & 2 deletions modules/glance/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ mkTarget {

configElements = [
(
{ polarity }:
{ colorGeneration }:
{
services.glance.settings.theme.light = polarity == "light";
services.glance.settings.theme.light = colorGeneration.polarity == "light";
}
)
(
Expand Down
4 changes: 2 additions & 2 deletions modules/gnome/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ mkTarget {
}
)
(
{ polarity }:
{ colorGeneration }:
{
# We show the same colours regardless of this setting, and the quick
# settings tile is removed. The value is still used by Epiphany to
# request dark mode for websites which support it.
dconf.settings."org/gnome/desktop/interface".color-scheme =
if polarity == "dark" then "prefer-dark" else "default";
if colorGeneration.polarity == "dark" then "prefer-dark" else "default";
}
)
(
Expand Down
2 changes: 1 addition & 1 deletion modules/gnome/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let
};
cursorCfg = config.stylix.cursor;
iconCfg = config.stylix.icons;
inherit (config.stylix) polarity;
inherit (config.stylix.colorGeneration) polarity;

in
{
Expand Down
5 changes: 2 additions & 3 deletions modules/kubecolor/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ mkTarget {

configElements = [
(
{ polarity }:
{ colorGeneration }:
{
programs.kubecolor.settings.preset =
if polarity == "either" then "" else polarity;
programs.kubecolor.settings.preset = colorGeneration.polarity;
}
)
(
Expand Down
6 changes: 3 additions & 3 deletions modules/obsidian/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ mkTarget {
{
cfg,
colors,
polarity,
colorGeneration,
}:
{
programs.obsidian.defaultSettings.cssSnippets = with colors.withHashtag; [
{
name = "Stylix Config";
text = ''
.theme-${polarity} {
.theme-${colorGeneration.polarity} {
/* Base Colors */
--color-base-00: ${base00};
--color-base-05: ${base00};
Expand All @@ -66,7 +66,7 @@ mkTarget {
{
name = "Stylix Config";
text = ''
.theme-${polarity} {
.theme-${colorGeneration.polarity} {
/* Base Colors */
--color-base-00: ${base00};
--color-base-05: ${base00};
Expand Down
8 changes: 6 additions & 2 deletions modules/qt/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@
config = lib.mkIf (config.stylix.enable && config.stylix.targets.qt.enable) (
let
icons =
if (config.stylix.polarity == "dark") then
if (config.stylix.colorGeneration.polarity == "dark") then
config.stylix.icons.dark
else
config.stylix.icons.light;

recommendedStyles = {
gnome = if config.stylix.polarity == "dark" then "adwaita-dark" else "adwaita";
gnome =
if config.stylix.colorGeneration.polarity == "dark" then
"adwaita-dark"
else
"adwaita";
kde = "breeze";
qtct = "kvantum";
};
Expand Down
6 changes: 5 additions & 1 deletion modules/qt/nixos.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{ lib, config, ... }:
let
recommendedStyle = {
gnome = if config.stylix.polarity == "dark" then "adwaita-dark" else "adwaita";
gnome =
if config.stylix.colorGeneration.polarity == "dark" then
"adwaita-dark"
else
"adwaita";
kde = "breeze";
qtct = "kvantum";
};
Expand Down
4 changes: 2 additions & 2 deletions modules/qutebrowser/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ mkTarget {
}
)
(
{ polarity }:
{ colorGeneration }:
{
programs.qutebrowser.settings.colors.webpage.preferred_color_scheme = lib.mkIf (
polarity == "dark"
colorGeneration.polarity == "dark"
) "dark";
}
)
Expand Down
8 changes: 4 additions & 4 deletions modules/regreet/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ mkTarget {
}
)
(
{ polarity }:
{ colorGeneration }:
{
programs.regreet.settings.GTK.application_prefer_dark_theme =
polarity == "dark";
colorGeneration.polarity == "dark";
}
)
(
Expand Down Expand Up @@ -104,11 +104,11 @@ mkTarget {
}
)
(
{ polarity, icons }:
{ colorGeneration, icons }:
{
programs.regreet.iconTheme = {
inherit (icons) package;
name = if (polarity == "dark") then icons.dark else icons.light;
name = if (colorGeneration.polarity == "dark") then icons.dark else icons.light;
};
}
)
Expand Down
4 changes: 2 additions & 2 deletions modules/vicinae/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ mkTarget {

configElements = lib.optionals (options.services ? vicinae) [
(
{ colors, polarity }:
{ colors, colorGeneration }:
{
services.vicinae = {
settings.theme.name = "stylix";
themes.stylix = {
meta = {
name = "stylix";
description = "theme generated by stylix";
variant = if polarity == "either" then "light" else polarity;
variant = colorGeneration.polarity;
};
colors = with colors.withHashtag; {
core = {
Expand Down
Loading
Loading