Merge branch 'danth:master' into freecad

This commit is contained in:
Michael McCandless 2024-06-12 15:15:33 +10:00 committed by GitHub
commit 3dc8ba803c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
102 changed files with 1757 additions and 757 deletions

View file

@ -1,8 +1,15 @@
name: Build
on:
push:
branches:
- master
- release-**
pull_request:
permissions:
contents: read
jobs:
evaluate:
name: List packages
@ -10,15 +17,19 @@ jobs:
steps:
- name: Install Nix
uses: cachix/install-nix-action@v22
uses: DeterminateSystems/nix-installer-action@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
extra-conf: |
extra-experimental-features = nix-command flakes
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: List packages
id: list-packages
run: |
nix flake show . --json | jq -rc 'to_entries | map(.key as $type | select($type == "checks" or $type == "packages") | .value | to_entries | map(.key as $arch | select($arch == "x86_64-linux" or $arch == "x86_64-darwin") | .value | to_entries | map({type: $type, arch: $arch, os: (if $arch == "x86_64-linux" then "ubuntu-latest" else "macos-latest" end), key: .key})) | flatten) | flatten | "packages=\(.)"' >> $GITHUB_OUTPUT
nix flake show github:${{ github.repository }}/${{ github.event.pull_request.head.sha || github.sha }} --json | jq -rc 'to_entries | map(.key as $type | select($type == "checks" or $type == "packages") | .value | to_entries | map(.key as $arch | select($arch == "x86_64-linux" or $arch == "x86_64-darwin") | .value | to_entries | map({type: $type, arch: $arch, os: (if $arch == "x86_64-linux" then "ubuntu-latest" else "macos-latest" end), key: .key})) | flatten) | flatten | "packages=\(.)"' >> $GITHUB_OUTPUT
outputs:
packages: ${{ steps.list-packages.outputs.packages }}
@ -37,10 +48,14 @@ jobs:
steps:
- name: Install Nix
uses: cachix/install-nix-action@v22
uses: DeterminateSystems/nix-installer-action@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
extra-conf: |
extra-experimental-features = nix-command flakes
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build ${{ matrix.build.key }}
run: nix -L build .#${{ matrix.build.type }}.${{ matrix.build.arch }}.${{ matrix.build.key }}
run: nix -L build github:${{ github.repository }}/${{ github.event.pull_request.head.sha || github.sha }}#${{ matrix.build.type }}.${{ matrix.build.arch }}.${{ matrix.build.key }}

View file

@ -16,13 +16,17 @@ jobs:
steps:
- name: Install Nix
uses: cachix/install-nix-action@v22
uses: DeterminateSystems/nix-installer-action@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
extra-conf: |
extra-experimental-features = nix-command flakes
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build docs
run: nix -L build .#docs
run: nix -L build github:${{ github.repository }}/${{ github.sha }}#docs
- name: Prepare docs for upload
run: cp -r --dereference --no-preserve=mode,ownership result/ public/

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
result
result-*

View file

@ -15,6 +15,7 @@ Where the scope is one of:
| Scope | Purpose |
|----------------|------------------------------------------------------------------------|
| `ci` | Changes to GitHub Actions workflows. |
| `doc` | Changes to the website, `README.md`, and so on. |
| `stylix` | Changes in the `stylix` directory, `flake.nix`, and other global code. |
| Name of target | Changes to code for a particular target. |

View file

@ -30,26 +30,39 @@ Certain features are only available with NixOS.
Please refer to the [Stylix book](https://danth.github.io/stylix/)
for instructions and a list of supported apps.
For a visual guide, watch the [*Ricing Linux Has Never Been Easier | NixOS +
Stylix*](https://youtu.be/ljHkWgBaQWU) YouTube video by
[Vimjoyer](https://www.youtube.com/@vimjoyer).
> [!NOTE]
>
> It's now necessary to include `stylix.enable = true` in your configuration
> for any other settings to take effect. This is not mentioned in the video
> linked above.
If you have any questions, you are welcome to
join our [Matrix room](https://matrix.to/#/#stylix:danth.me),
or ask on [GitHub Discussions](https://github.com/danth/stylix/discussions).
## Example configurations
![GNOME 44](https://user-images.githubusercontent.com/28959268/233449152-c38d0214-0991-454d-abbf-41b5e89dee3a.png)
### GNOME 46
| Environment | Wallpaper | Colour scheme | Fonts | Full configuration |
|-------------|-----------------------------------------------------------------------------------------|---------------------|----------------------|----------------------------------------------------------------------------|
| GNOME 44 | [Atlantis Garbage Worker by Grady Frederick](https://www.artstation.com/artwork/W2GERJ) | Generated by Stylix | Cantarell, Fira Code | [See here](https://gist.github.com/danth/5e0b263eeed99aafcef2a2eca3e8548d) |
![GNOME 46](./gnome.png)
![KDE Plasma 5](https://github.com/danth/stylix/assets/28959268/f0ee5ce2-cd4a-4875-b44b-f974f97ecd71)
Photos by [Clay Banks](https://unsplash.com/photos/three-bicycles-parked-in-front-of-building-hwLAI5lRhdM)
and [Derrick Cooper](https://unsplash.com/photos/brown-road-in-forest-during-daytime-L505cPnmIds).
| Environment | Wallpaper | Colour scheme | Fonts | Full configuration |
|--------------|---------------------------------------------------------------|---------------------|----------------------|----------------------------------------------------------------------------|
| KDE Plasma 5 | Taken from [Genshin Impact](https://genshin.hoyoverse.com/en) | Generated by Stylix | Cantarell, Fira Code | [See here](https://gist.github.com/danth/17dd596a9f655a252c14b23a60dd2aaf) |
Try a live demo of this theme by running
`nix run github:danth/stylix#testbed-gnome-light` or
`nix run github:danth/stylix#testbed-gnome-dark`.
![Hyprland](https://raw.githubusercontent.com/SomeGuyNamedMy/Screenshots/60cd34c7c822042e33d0a1d7ae98a64290aa6dab/example2.png)
### KDE Plasma 5
| Environment | Wallpaper | Colour scheme | Fonts | Full configuration |
|-------------|-----------------------------------------------------------------------------------------|---------------------|----------------------|-----------------------------------------------------|
| Hyprland | Taken from [raison d'etre by Eve](https://www.youtube.com/watch?v=ulfY8WQE_HE) | Generated by Stylix | DeJavu | [See here](https://github.com/SomeGuyNamedMy/users) |
![KDE Plasma 5](./kde.png)
Photos by [Aniket Deole](https://unsplash.com/photos/mountain-surrounded-by-trees-under-cloudy-sky-T-tOgjWZ0fQ)
and [Tom Gainor](https://unsplash.com/photos/landscape-photography-of-body-of-water-overlooking-mountain-range-ZqLeQDjY6fY).
KDE theming is still a work in progress - so some manual steps may be needed
to apply the settings completely.

View file

@ -43,8 +43,18 @@ in pkgs.stdenvNoCC.mkDerivation {
patchPhase = ''
cp ${../README.md} src/README.md
cp ${../gnome.png} src/gnome.png
cp ${../kde.png} src/kde.png
cp ${../CONTRIBUTING.md} src/contributing.md
# mdBook doesn't support this Markdown extension yet
substituteInPlace **/*.md \
--replace-quiet '> [!NOTE]' '> **Note**' \
--replace-quiet '> [!TIP]' '> **Tip**' \
--replace-quiet '> [!IMPORTANT]' '> **Important**' \
--replace-quiet '> [!WARNING]' '> **Warning**' \
--replace-quiet '> [!CAUTION]' '> **Caution**'
# The "declared by" links point to a file which only exists when the docs
# are built locally. This removes the links.
sed '/*Declared by:*/,/^$/d' <${nixos.optionsCommonMark} >>src/options/nixos.md

View file

@ -15,4 +15,5 @@
- [Contributing](contributing.md)
- [Adding modules](modules.md)
- [Testbeds](testbeds.md)
- [Style guide](styling.md)

View file

@ -1,5 +1,21 @@
# Configuration
## Enable
To enable the Stylix module, declare:
```nix
{
stylix.enable = true;
}
```
> [!NOTE]
>
> The global enable option was recently added, so you may come across old
> examples which don't include it. No other settings will take effect unless
> `stylix.enable` is set to `true`.
## Wallpaper
To start theming, you need to set a wallpaper image.
@ -69,6 +85,37 @@ and the user-provided one are used in the user configuration if
`stylix.base16Scheme` is not changed in the user config. If that is the case,
only the user override is used.
### Extending
When passing colors to unsupported targets or creating custom modules, it
is possible to access values from the configured color scheme through
`lib.stylix.colors`.
An overview of the available values is shown below.
```nix
lib.stylix.colors = {
base08 = "ff0000";
base08-hex-r = "ff";
base08-dec-r = "0.996094";
# ...
red = "ff0000";
# ...
withHashtag = {
base08 = "#ff0000";
# ...
};
};
```
This attrset is generated by `mkSchemeAttrs` from `base16.nix`. Refer to the
[documentation](https://github.com/SenchoPens/base16.nix/blob/main/DOCUMENTATION.md#mkschemeattrs)
for more info.
For more complex configurations you may find it simpler to use
[mustache](http://mustache.github.io/) templates to generate output files.
See [base16.nix](https://github.com/SenchoPens/base16.nix) documentation for
usage examples.
## Fonts
The default combination of fonts is:
@ -122,28 +169,36 @@ Or even choose monospace for everything:
}
```
## Multi-user configurations
## Home Manager inheritance
For those apps which are configured through Home Manager, Stylix allows you to
choose a different theme for each user. This can be done by setting the theme
within Home Manager for that user rather than at the system level.
By default, if Home Manager is used as part of NixOS, then Stylix will be
automatically installed for all users, and the NixOS theme will become their
default settings.
By default, all users follow the system theme. This can be turned off by
setting `stylix.homeManagerIntegration.followSystem = false`, in which case you
must explicitly set a theme for each user. Setting that option is not required
just to be able to override an individual theme.
This is convenient for single-user systems, since you can configure everything
once at the system level and it will automatically carry over. For multi-user
systems, you can override the settings within Home Manager to select a different
theme for each user.
If you would like to disable all Home Manager activity for a user, you can set
`stylix.homeManagerIntegration.autoImport = false`, then manually import the
Home Manager module for the users for which it should be enabled.
You may prefer to disable inheritance entirely, and set up the Home Manager
version of Stylix yourself if required. Refer to the options
[`stylix.homeManagerIntegration.autoImport`](options/nixos.md#stylixhomemanagerintegrationautoimport)
and
[`stylix.homeManagerIntegration.followSystem`](options/nixos.md#stylixhomemanagerintegrationfollowsystem)
to customize this.
Note that if the wallpaper image for a user is different to the rest of the
system, a separate theme will always be generated for them, even though their
`base16Scheme` option has not been overridden. If you want that user to follow
the system theme while having a different wallpaper, you will need to manually
copy the system theme into their configuration. (This behaviour is necessary as
otherwise it would be impossible to use a generated theme for a user while
having a manually created theme for the rest of the system.)
> [!NOTE]
>
> There is a special case involving the
> [`stylix.base16Scheme`](options/nixos.md#stylixbase16scheme)
> option:
>
> If the wallpaper in a Home Manager configuration is changed, then Home Manager
> will stop inheriting the color scheme from NixOS. This allows Home Manager
> configurations to use the automatic palette generator without being overridden.
>
> Similarly, [`stylix.override`](options/nixos.md#stylixoverride) is not inherited
> if the color scheme is different.
## Turning targets on and off

View file

@ -27,7 +27,7 @@ Many applications cannot be configured system wide, so Stylix will also need
[Home Manager][nix-hm] to be able to change their settings within your home
directory.
[Installing Home Manager as a NixOS module](https://nix-community.github.io/home-manager/index.html#sec-install-nixos-module)
[Installing Home Manager as a NixOS module](https://nix-community.github.io/home-manager/index.xhtml#sec-install-nixos-module)
is highly recommended if you don't use it already. This will combine it with
your existing configuration, so you don't need to run any extra commands when
you rebuild, and the theme you set in NixOS will automatically be used for Home
@ -119,11 +119,14 @@ let
in {
imports = [ (import stylix).homeManagerModules.stylix ];
stylix.image = ./wallpaper.jpg;
stylix = {
enable = true;
image = ./wallpaper.jpg;
};
}
```
<small>Example usage of the Home Manager module without flakes.</small>
[nix-flakes]: https://nixos.wiki/wiki/Flakes
[nix-flakes]: https://wiki.nixos.org/wiki/Flakes
[nix-hm]: https://github.com/nix-community/home-manager

View file

@ -37,6 +37,7 @@ All modules should have an enable option created using `mkEnableTarget`.
This is similar to
[`mkEnableOption`](https://nix-community.github.io/docnix/reference/lib/options/lib-options-mkenableoption/)
from the standard library, however it integrates with
[`stylix.enable`](./options/nixos.md#stylixenable) and
[`stylix.autoEnable`](./options/nixos.md#stylixautoenable)
and generates more specific documentation.
@ -46,16 +47,29 @@ A general format for modules is shown below.
{ config, lib, ... }:
{
stylix.targets.«name».enable = config.lib.stylix.mkEnableTarget "«human readable name»";
options.stylix.targets.«name».enable =
config.lib.stylix.mkEnableTarget "«human readable name»" true;
config = lib.mkIf config.stylix.targets.«name».enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.«name».enable) {
programs.«name».backgroundColor = config.lib.stylix.colors.base00;
};
}
```
The human readable name must fit into the following sentence:
The human readable name will be inserted into the following sentence:
> Whether to style «human readable name».
> Whether to enable theming for «human readable name».
If your module will touch options outside of `programs.«name»` or `services.«name»`,
it should include an additional condition in `mkIf` to prevent any effects
when the target is not installed.
The boolean value after `mkEnableTarget` should be changed to `false` if
one of the following applies:
- The module requires further manual setup to work correctly.
- There is no reliable way to detect whether the target is installed, *and*
enabling it unconditionally would cause problems.
## How to apply colors

View file

@ -46,7 +46,7 @@ the currently active item, or there could be multiple selected depending on the
- Default background: base00
- Alternate background: base01
- Selection background: base03
- Selection background: base02
- Default text: base05
- Alternate text: base04
- Warning: base0A
@ -67,10 +67,10 @@ An urgent window is one which is grabbing for attention - Windows shows this by
a flashing orange taskbar icon.
- Unfocused window border: base03
- Focused window border: base0A
- Unfocused window border in group: base0D
- Focused window border in group: base06
- Urgent window border: base07
- Focused window border: base0D
- Unfocused window border in group: base03
- Focused window border in group: base0D
- Urgent window border: base08
- Window title text: base05
## Notifications and Popups

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

83
docs/src/testbeds.md Normal file
View file

@ -0,0 +1,83 @@
# Testbeds
Stylix provides a suite of virtual machines which can be used to test and
preview themes without installing the target to your live system.
These can be particularly helpful for:
- Working on targets before the login screen, since you can avoid closing
your editor to see the result.
- Developing for a different desktop environment than the one you normally use.
- Reducing the risk of breaking your system while reviewing pull requests.
Testbeds are also built by GitHub Actions for every pull request. This is less
beneficial compared to running them yourself, since it cannot visually check
the theme, however it can catch build failures which may have been missed
otherwise.
## Creation
New testbeds are defined by creating a file called `testbed.nix` within the
folder for the corresponding target. This file will automatically be loaded
as a NixOS module, with options such as `stylix.image` already defined.
The module should include any options necessary to install the target and
any supporting software - for example, a window manager.
If the target can only be used through Home Manager, you can write a
Home Manager module within the NixOS module using the following format:
```nix
{
home-manager.sharedModules = [{
# Write Home Manager options here
}];
}
```
Using `home-manager.sharedModules` is preferred over `home-manager.users.guest`
since it allows us to easily change the username or add additional users in
the future.
Once the module is complete, use `git add` to track the file, then the new
packages will be [available to use](#usage).
## Usage
You can list the available testbeds by running this command from anywhere
within the repository:
```console
user@host:~$ nix flake show
github:danth/stylix
└───packages
└───x86_64-linux
├───docs: package 'stylix-book'
├───palette-generator: package 'palette-generator'
├───testbed-gnome-dark: package 'testbed-gnome-dark'
├───testbed-gnome-light: package 'testbed-gnome-light'
├───testbed-kde-dark: package 'testbed-kde-dark'
└───testbed-kde-light: package 'testbed-kde-light'
```
(This has been edited down to only the relevant parts.)
To start a testbed, each of which is named in the format
`testbed-«target»-«polarity»`, run the following command:
```console
user@host:~$ nix run .#testbed-«target»-«polarity»
```
Any package with a name not fitting the given format is not a testbed,
and may behave differently with this command, or not work at all.
Once the virtual machine starts, a window should open, similar to the screenshot
below. The contents of the virtual machine will vary depending on the target you
selected earlier.
![GDM login screen with a dark background color and showing a guest user](testbed-gnome-dark.png)
If the testbed includes a login screen, the guest user should log in
automatically when selected. Depending on the software used, you may still be
presented with a password prompt - in which case you can leave it blank and
proceed by pressing enter.

View file

@ -31,7 +31,7 @@ Similarly, you can use a template image and repaint it for the current theme.
{ pkgs, ... }:
let
theme = "${pkgs.base16-schemes}/share/themes/catppuccin.yaml";
theme = "${pkgs.base16-schemes}/share/themes/catppuccin-latte.yaml";
wallpaper = pkgs.runCommand "image.png" {} ''
COLOR=$(${pkgs.yq}/bin/yq -r .base00 ${theme})
COLOR="#"$COLOR
@ -44,3 +44,16 @@ in {
};
}
```
Which is neatly implemented as a single function in `lib.stylix.pixel`:
```nix
{ pkgs, config, ... }:
{
stylix = {
image = config.lib.stylix.pixel "base0A";
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-latte.yaml";
};
}
```

61
flake.lock generated
View file

@ -5,11 +5,11 @@
"fromYaml": "fromYaml"
},
"locked": {
"lastModified": 1705180696,
"narHash": "sha256-6TwTHERD+2SX21zvBwmm58mtmgVXHLPu273i04JdH9Y=",
"lastModified": 1708890466,
"narHash": "sha256-LlrC09LoPi8OPYOGPXegD72v+//VapgAqhbOFS3i8sc=",
"owner": "SenchoPens",
"repo": "base16.nix",
"rev": "b390e87cd404e65ab4d786666351f1292e89162a",
"rev": "665b3c6748534eb766c777298721cece9453fdae",
"type": "github"
},
"original": {
@ -18,39 +18,6 @@
"type": "github"
}
},
"base16-alacritty": {
"flake": false,
"locked": {
"lastModified": 1703982197,
"narHash": "sha256-TNxKbwdiUXGi4Z4chT72l3mt3GSvOcz6NZsUH8bQU/k=",
"owner": "aarowill",
"repo": "base16-alacritty",
"rev": "c95c200b3af739708455a03b5d185d3d2d263c6e",
"type": "github"
},
"original": {
"owner": "aarowill",
"repo": "base16-alacritty",
"type": "github"
}
},
"base16-alacritty-yaml": {
"flake": false,
"locked": {
"lastModified": 1674275109,
"narHash": "sha256-Adwx9yP70I6mJrjjODOgZJjt4OPPe8gJu7UuBboXO4M=",
"owner": "aarowill",
"repo": "base16-alacritty",
"rev": "63d8ae5dfefe5db825dd4c699d0cdc2fc2c3eaf7",
"type": "github"
},
"original": {
"owner": "aarowill",
"repo": "base16-alacritty",
"rev": "63d8ae5dfefe5db825dd4c699d0cdc2fc2c3eaf7",
"type": "github"
}
},
"base16-fish": {
"flake": false,
"locked": {
@ -182,16 +149,16 @@
"gnome-shell": {
"flake": false,
"locked": {
"lastModified": 1698794309,
"narHash": "sha256-/TIkZ8y5Wv3QHLFp79Poao9fINurKs5pa4z0CRe+F8s=",
"lastModified": 1713702291,
"narHash": "sha256-zYP1ehjtcV8fo+c+JFfkAqktZ384Y+y779fzmR9lQAU=",
"owner": "GNOME",
"repo": "gnome-shell",
"rev": "a7c169c6c29cf02a4c392fa0acbbc5f5072823e7",
"rev": "0d0aadf013f78a7f7f1dc984d0d812971864b934",
"type": "github"
},
"original": {
"owner": "GNOME",
"ref": "45.1",
"ref": "46.1",
"repo": "gnome-shell",
"type": "github"
}
@ -203,11 +170,11 @@
]
},
"locked": {
"lastModified": 1706001011,
"narHash": "sha256-J7Bs9LHdZubgNHZ6+eE/7C18lZ1P6S5/zdJSdXFItI4=",
"lastModified": 1714981474,
"narHash": "sha256-b3/U21CJjCjJKmA9WqUbZGZgCvospO3ArOUTgJugkOY=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "3df2a80f3f85f91ea06e5e91071fa74ba92e5084",
"rev": "6ebe7be2e67be7b9b54d61ce5704f6fb466c536f",
"type": "github"
},
"original": {
@ -218,11 +185,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1700856099,
"narHash": "sha256-RnEA7iJ36Ay9jI0WwP+/y4zjEhmeN6Cjs9VOFBH7eVQ=",
"lastModified": 1714912032,
"narHash": "sha256-clkcOIkg8G4xuJh+1onLG4HPMpbtzdLv4rHxFzgsH9c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0bd59c54ef06bc34eca01e37d689f5e46b3fe2f1",
"rev": "ee4a6e0f566fe5ec79968c57a9c2c3c25f2cf41d",
"type": "github"
},
"original": {
@ -235,8 +202,6 @@
"root": {
"inputs": {
"base16": "base16",
"base16-alacritty": "base16-alacritty",
"base16-alacritty-yaml": "base16-alacritty-yaml",
"base16-fish": "base16-fish",
"base16-foot": "base16-foot",
"base16-helix": "base16-helix",

View file

@ -1,15 +1,5 @@
{
inputs = {
base16-alacritty = {
flake = false;
url = "github:aarowill/base16-alacritty";
};
base16-alacritty-yaml = {
flake = false;
url = "github:aarowill/base16-alacritty/63d8ae5dfefe5db825dd4c699d0cdc2fc2c3eaf7";
};
base16-fish = {
flake = false;
url = "github:tomyun/base16-fish";
@ -53,7 +43,7 @@
# TODO: Unlocking the input and pointing to official repository requires
# updating the patch:
# https://github.com/danth/stylix/pull/224#discussion_r1460339607.
url = "github:GNOME/gnome-shell/45.1";
url = "github:GNOME/gnome-shell/46.1";
};
# The 'home-manager' input is used to generate the documentation.
@ -76,15 +66,22 @@
"x86_64-linux"
] (
system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
docs = import ./docs {
inherit pkgs inputs;
inherit (nixpkgs) lib;
let
inherit (nixpkgs) lib;
pkgs = nixpkgs.legacyPackages.${system};
universalPackages = {
docs = import ./docs { inherit pkgs inputs lib; };
palette-generator = pkgs.callPackage ./palette-generator { };
};
palette-generator = pkgs.callPackage ./palette-generator { };
}
# Testbeds are virtual machines based on NixOS, therefore they are
# only available for Linux systems.
testbedPackages = lib.optionalAttrs
(lib.hasSuffix "-linux" system)
(import ./stylix/testbed.nix { inherit pkgs inputs lib; });
in
universalPackages // testbedPackages
);
nixosModules.stylix = { pkgs, ... }@args: {

BIN
gnome.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 996 KiB

BIN
kde.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 853 KiB

View file

@ -1,23 +1,17 @@
{pkgs, config, lib, ... }:
with config.stylix.fonts;
# Documentation is available at:
# - https://alacritty.org/config-alacritty.html
# - `man 5 alacritty`
{ config, lib, ... }:
let
useYaml = (builtins.compareVersions config.programs.alacritty.package.version "0.13.0") < 0;
templateRepo = config.lib.stylix.templates.
"base16-alacritty${if useYaml then "-yaml" else ""}";
themeFile = config.lib.stylix.colors {
inherit templateRepo;
};
colors = config.lib.stylix.colors.withHashtag;
in
{
options.stylix.targets.alacritty.enable =
config.lib.stylix.mkEnableTarget "Alacritty" true;
options.stylix.targets.alacritty.enable = config.lib.stylix.mkEnableTarget "Alacritty" true;
config = lib.mkIf config.stylix.targets.alacritty.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.alacritty.enable) {
programs.alacritty.settings = {
font = {
font = with config.stylix.fonts; {
normal = {
family = monospace.name;
style = "Regular";
@ -25,7 +19,36 @@ in
size = sizes.terminal;
};
window.opacity = with config.stylix.opacity; terminal;
import = [ themeFile ];
colors = with colors; {
primary = {
foreground = base05;
background = base00;
bright_foreground = base07;
};
selection = {
text = base05;
background = base02;
};
cursor = {
text = base00;
cursor = base05;
};
normal = {
black = base00;
white = base05;
inherit red green yellow blue magenta cyan;
};
bright = {
black = base03;
white = base07;
red = bright-red;
green = bright-green;
yellow = yellow;
blue = bright-blue;
magenta = bright-magenta;
cyan = bright-cyan;
};
};
};
};
}

View file

@ -10,7 +10,7 @@ in
config.lib.stylix.mkEnableTarget "Avizo" true;
# Referenced https://github.com/stacyharper/base16-mako
config = lib.optionalAttrs (options.services ? avizo) (lib.mkIf config.stylix.targets.avizo.enable {
config = lib.optionalAttrs (options.services ? avizo) (lib.mkIf (config.stylix.enable && config.stylix.targets.avizo.enable) {
services.avizo = {
settings = {
default = {

View file

@ -2,13 +2,18 @@
{
options.stylix.targets.bat.enable =
config.lib.stylix.mkEnableTarget "Bat" config.programs.bat.enable;
config.lib.stylix.mkEnableTarget "Bat" true;
config = lib.mkIf config.stylix.targets.bat.enable {
programs.bat.themes."base16-stylix".src = config.lib.stylix.colors {
template = ./base16-stylix.mustache;
extension = ".tmTheme";
config = lib.mkIf (config.stylix.enable && config.stylix.targets.bat.enable) {
programs.bat = {
# This theme is reused for yazi. Changes to the template
# will need to be applied to modules/yazi/hm.nix
themes."base16-stylix".src = config.lib.stylix.colors {
template = ./base16-stylix.mustache;
extension = ".tmTheme";
};
config.theme = "base16-stylix";
};
home.sessionVariables.BAT_THEME = "base16-stylix";
};
}

View file

@ -9,7 +9,7 @@ in {
enable = config.lib.stylix.mkEnableTarget "bemenu" true;
fontSize = lib.mkOption {
description = lib.mdDoc ''
description = ''
Font size used for bemenu.
'';
type = with lib.types; nullOr int;
@ -17,7 +17,7 @@ in {
}; # optional argument
alternate = lib.mkOption {
description = lib.mdDoc ''
description = ''
Whether to use alternating colours.
'';
type = lib.types.bool;
@ -25,7 +25,7 @@ in {
};
};
config = lib.mkIf config.stylix.targets.bemenu.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.bemenu.enable) {
programs.bemenu.settings = with config.stylix.targets.bemenu; {
tb = "${base01}${bemenuOpacity}"; # Title bg
nb = "${base01}${bemenuOpacity}"; # Normal bg

View file

@ -6,12 +6,12 @@ in {
options.stylix.targets.bspwm.enable =
config.lib.stylix.mkEnableTarget "bspwm" true;
config = lib.mkIf config.stylix.targets.bspwm.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.bspwm.enable) {
xsession.windowManager.bspwm.settings = {
active_border_color = colors.base08;
normal_border_color = colors.base02;
focused_border_color = colors.base0F;
presel_feedback_color = colors.base08;
normal_border_color = colors.base03;
active_border_color = colors.base0C;
focused_border_color = colors.base0D;
presel_feedback_color = colors.base00;
};
};
}

View file

@ -3,11 +3,14 @@
let
colors = config.lib.stylix.colors.withHashtag;
in {
options.stylix.targets.btop.enable = config.lib.stylix.mkEnableTarget "btop" config.programs.btop.enable;
options.stylix.targets.btop.enable = config.lib.stylix.mkEnableTarget "btop" true;
config = lib.mkIf config.stylix.targets.btop.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.btop.enable && config.programs.btop.enable) {
programs.btop.settings.color_theme = "stylix";
programs.btop.settings = {
color_theme = "stylix";
theme_background = lib.mkIf (config.stylix.opacity.terminal != 1.0) false;
};
xdg.configFile."btop/themes/stylix.theme".text = with colors; ''
#Generated by Stylix

View file

@ -4,7 +4,7 @@
options.stylix.targets.chromium.enable =
config.lib.stylix.mkEnableTarget "Chromium, Google Chrome and Brave" true;
config.programs.chromium = lib.mkIf config.stylix.targets.chromium.enable {
config.programs.chromium = lib.mkIf (config.stylix.enable && config.stylix.targets.chromium.enable) {
# This enables policies without installing the browser. Policies take up a
# negligible amount of space, so it's reasonable to have this always on.
enable = true;

View file

@ -6,22 +6,22 @@ with config.lib.stylix.colors;
options.stylix.targets.console.enable =
config.lib.stylix.mkEnableTarget "the Linux kernel console" true;
config.console.colors = lib.mkIf config.stylix.targets.console.enable [
config.console.colors = lib.mkIf (config.stylix.enable && config.stylix.targets.console.enable) [
base00-hex
base08-hex
base0B-hex
base0A-hex
base0D-hex
base0E-hex
base0C-hex
red
green
yellow
blue
magenta
cyan
base05-hex
base03-hex
base09-hex
base01-hex
base02-hex
base04-hex
red
green
yellow
blue
magenta
cyan
base06-hex
base0F-hex
base07-hex
];
}

View file

@ -8,7 +8,7 @@ in {
options.stylix.targets.dunst.enable =
config.lib.stylix.mkEnableTarget "Dunst" true;
config = lib.mkIf config.stylix.targets.dunst.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.dunst.enable) {
services.dunst.settings = {
global = {
separator_color = base02;

View file

@ -8,9 +8,9 @@ let
in
{
options.stylix.targets.emacs.enable =
config.lib.stylix.mkEnableTarget "Emacs" config.programs.emacs.enable;
config.lib.stylix.mkEnableTarget "Emacs" true;
config = lib.mkIf config.stylix.targets.emacs.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.emacs.enable) {
programs.emacs = {
extraPackages = epkgs:
[

View file

@ -4,13 +4,20 @@
options.stylix.targets.feh.enable =
config.lib.stylix.mkEnableTarget
"the desktop background using Feh"
(with config.xsession.windowManager; bspwm.enable
|| herbstluftwm.enable
|| i3.enable
|| spectrwm.enable
|| xmonad.enable);
true;
config.xsession.initExtra =
lib.mkIf config.stylix.targets.feh.enable
lib.mkIf (
config.stylix.enable
&& config.stylix.targets.feh.enable
&& (
with config.xsession.windowManager;
bspwm.enable
|| herbstluftwm.enable
|| i3.enable
|| spectrwm.enable
|| xmonad.enable
)
)
"${pkgs.feh}/bin/feh --no-fehbg --bg-scale ${config.stylix.image}";
}

View file

@ -4,9 +4,17 @@
options.stylix.targets.feh.enable =
config.lib.stylix.mkEnableTarget
"the desktop background using Feh"
(with config.services.xserver.windowManager; xmonad.enable || i3.enable);
true;
config.services.xserver.displayManager.sessionCommands =
lib.mkIf config.stylix.targets.feh.enable
lib.mkIf (
config.stylix.enable
&& config.stylix.targets.feh.enable
&& (
with config.services.xserver.windowManager;
xmonad.enable
|| i3.enable
)
)
"${pkgs.feh}/bin/feh --no-fehbg --bg-scale ${config.stylix.image}";
}

View file

@ -13,7 +13,7 @@ let
in {
options.stylix.targets.firefox = {
enable =
config.lib.stylix.mkEnableTarget "Firefox" config.programs.firefox.enable;
config.lib.stylix.mkEnableTarget "Firefox" true;
profileNames = lib.mkOption {
description = "The Firefox profile names to apply styling on.";
@ -22,7 +22,7 @@ in {
};
};
config = lib.mkIf config.stylix.targets.firefox.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.firefox.enable) {
programs.firefox.profiles = lib.listToAttrs
(map makeProfileSettingsPair config.stylix.targets.firefox.profileNames);
};

View file

@ -4,7 +4,7 @@
options.stylix.targets.fish.enable =
config.lib.stylix.mkEnableTarget "Fish" true;
config = lib.mkIf config.stylix.targets.fish.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.fish.enable) {
programs.fish.interactiveShellInit = import ./prompt.nix { inherit pkgs config; };
};
}

View file

@ -4,7 +4,7 @@
options.stylix.targets.fish.enable =
config.lib.stylix.mkEnableTarget "Fish" true;
config = lib.mkIf config.stylix.targets.fish.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.fish.enable) {
programs.fish.promptInit = import ./prompt.nix { inherit pkgs config; };
};
}

View file

@ -7,10 +7,10 @@ let
in {
options.stylix.targets.fuzzel.enable =
config.lib.stylix.mkEnableTarget "Fuzzel" config.programs.fuzzel.enable;
config.lib.stylix.mkEnableTarget "Fuzzel" true;
config.programs.fuzzel.settings =
lib.mkIf config.stylix.targets.fuzzel.enable {
lib.mkIf (config.stylix.enable && config.stylix.targets.fuzzel.enable) {
colors = {
background = "${base00-hex}${opacity}";
text = "${base05-hex}ff";

View file

@ -20,10 +20,10 @@ let
in
{
options.stylix.targets.fzf = {
enable = config.lib.stylix.mkEnableTarget "Fzf" config.programs.fzf.enable;
enable = config.lib.stylix.mkEnableTarget "Fzf" true;
};
config = lib.mkIf config.stylix.targets.fzf.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.fzf.enable) {
programs.fzf.defaultOptions = lib.mkAfter [ "--color=${colorConfig}" ];
};
}

View file

@ -10,7 +10,7 @@ in {
options.stylix.targets.gedit.enable =
config.lib.stylix.mkEnableTarget "GEdit" true;
config = lib.mkIf config.stylix.targets.gedit.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.gedit.enable) {
xdg.dataFile = {
"gedit/styles/stylix.xml".source = style;
};

44
modules/gitui/hm.nix Normal file
View file

@ -0,0 +1,44 @@
{ config, lib, ... }:
let
inherit (config.lib.stylix) colors;
mkRgb = color:
let
r = colors."${color}-rgb-r";
g = colors."${color}-rgb-g";
b = colors."${color}-rgb-b";
in
"Rgb(${r}, ${g}, ${b})";
in
{
options.stylix.targets.gitui.enable =
config.lib.stylix.mkEnableTarget "GitUI" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.gitui.enable) {
programs.gitui.theme = ''
(
selected_tab: Some(Reset),
command_fg: Some(${mkRgb "base05"}),
selection_bg: Some(${mkRgb "base04"}),
selection_fg: Some(${mkRgb "base05"}),
cmdbar_bg: Some(${mkRgb "base01"}),
cmdbar_extra_lines_bg: Some(${mkRgb "base01"}),
disabled_fg: Some(${mkRgb "base04"}),
diff_line_add: Some(${mkRgb "base0B"}),
diff_line_delete: Some(${mkRgb "base08"}),
diff_file_added: Some(${mkRgb "base0A"}),
diff_file_removed: Some(${mkRgb "base08"}),
diff_file_moved: Some(${mkRgb "base0E"}),
diff_file_modified: Some(${mkRgb "base09"}),
commit_hash: Some(${mkRgb "base07"}),
commit_time: Some(${mkRgb "base05"}),
commit_author: Some(${mkRgb "base0D"}),
danger_fg: Some(${mkRgb "base08"}),
push_gauge_bg: Some(${mkRgb "base0D"}),
push_gauge_fg: Some(${mkRgb "base00"}),
tag_fg: Some(${mkRgb "base06"}),
branch_fg: Some(${mkRgb "base0C"})
)
'';
};
}

View file

@ -1,45 +1,69 @@
$is_highcontrast: false;
// _default-colors.scss
$descructive_bg_color: #{{base08-hex}};
$descructive_fg_color: #{{base00-hex}};
$destructive_color: #{{base08-hex}};
$success_bg_color: #{{base0B-hex}};
$success_fg_color: #{{base00-hex}};
$success_color: #{{base0B-hex}};
$warning_bg_color: #{{base0A-hex}};
$warning_fg_color: #{{base00-hex}};
$warning_color: #{{base0A-hex}};
$error_bg_color: #{{base08-hex}};
$error_fg_color: #{{base00-hex}};
$error_color: #{{base08-hex}};
$selected_bg_color: #{{base0D-hex}};
$selected_fg_color: #{{base00-hex}};
$link_color: #{{base0D-hex}};
$link_visited_color: transparentize($link_color, 0.4);
$background_mix_factor: 0%;
$border_opacity: 1;
$shadow_color: transparent;
$text_shadow_color: transparent;
$focus_color: $selected_bg_color;
$focus_border_color: transparentize(#{{base05-hex}}, 0.5);
// _colors.scss
$base_color: #{{base01-hex}};
$bg_color: #{{base00-hex}};
$fg_color: #{{base05-hex}};
$borders_color: transparentize($bg_color, 0.9);
$outer_borders_color: transparentize($bg_color, 0.98);
$selected_fg_color: #{{base00-hex}};
$selected_bg_color: #{{base0D-hex}};
$selected_borders_color: transparentize($selected_bg_color, 0.9);
$link_color: #{{base0D-hex}};
$link_visited_color: #{{base0D-hex}};
$warning_color: #{{base0A-hex}};
$error_color: #{{base08-hex}};
$success_color: #{{base0B-hex}};
$destructive_color: $error_color;
$osd_bg_color: #{{base01-hex}};
$osd_fg_color: #{{base05-hex}};
$osd_insensitive_bg_color: #{{base01-hex}};
$osd_insensitive_fg_color: #{{base05-hex}};
$osd_borders_color: transparentize($osd_bg_color, 0.9);
$osd_outer_borders_color: transparentize($osd_bg_color, 0.98);
$shadow_color: rgba(0,0,0,0.1);
$button_mix_factor: 0%;
$bubble_buttons_color: #{{base01-hex}};
$osd_bg_color: #{{base01-hex}};
$system_base_color: #{{base00-hex}};
$system_fg_color: #{{base05-hex}};
$system_bg_color: #{{base00-hex}};
$system_borders_color: transparentize($system_bg_color, .9);
$system_insensitive_fg_color: #{{base05-hex}};
$system_overlay_bg_color: #{{base01-hex}}; // for non-transparent items, e.g. dash
$insensitive_fg_color: #{{base05-hex}};
$insensitive_bg_color: #{{base01-hex}};
$insensitive_borders_color: transparentize($insensitive_bg_color, 0.9);
$panel_bg_color: #{{base01-hex}};
$panel_fg_color: #{{base05-hex}};
$card_bg_color: #{{base01-hex}};
$card_shadow_color: transparent;
$card_shadow_border_color: transparent;
$borders_color: transparentize(#{{base05-hex}}, 0.8);
$outer_borders_color: transparentize(#{{base05-hex}}, 0.9);
$osd_borders_color: $borders_color;
$osd_outer_borders_color: $outer_borders_color;
$system_bg_color: #{{base00-hex}};
$system_borders_color: $borders_color;
$system_insensitive_fg_color: #{{base05-hex}};
$system_overlay_bg_color: #{{base01-hex}};
$insensitive_fg_color: #{{base04-hex}};
$insensitive_bg_color: #{{base00-hex}};
$insensitive_borders_color: $borders_color;
$checked_bg_color: #{{base01-hex}};
$checked_fg_color: #{{base05-hex}};
@ -49,3 +73,12 @@ $hover_fg_color: #{{base05-hex}};
$active_bg_color: #{{base01-hex}};
$active_fg_color: #{{base05-hex}};
$selected_borders_color: transparentize(#{{base05-hex}}, 0.5);
// Other required variables
$_base_color_light: #eeeeee;
$light_1: #ffffff;
$red_4: #{{base08-hex}};
$orange_4: #{{base09-hex}};

View file

@ -6,7 +6,7 @@ with lib;
options.stylix.targets.gnome.enable =
config.lib.stylix.mkEnableTarget "GNOME" true;
config = mkIf config.stylix.targets.gnome.enable {
config = mkIf (config.stylix.enable && config.stylix.targets.gnome.enable) {
dconf.settings = {
"org/gnome/desktop/background" = {
color-shading-type = "solid";
@ -39,7 +39,7 @@ with lib;
let theme = import ./theme.nix args;
in "${theme}/share/gnome-shell/gnome-shell.css";
onChange = ''
if [ -x "$(command -v gnome-extensions)" ]; then
if [[ -x "$(command -v gnome-extensions)" ]]; then
gnome-extensions disable user-theme@gnome-shell-extensions.gcampax.github.com
gnome-extensions enable user-theme@gnome-shell-extensions.gcampax.github.com
fi

View file

@ -1,22 +1,17 @@
{ pkgs, config, ... }@args:
{ lib, pkgs, config, ... }@args:
let
# We use this imported lib instead of the one from the module arguments
# to avoid infinite loops if the lib in arguments depends on nixpkgs.overlays
lib = (builtins.getFlake "github:nix-community/nixpkgs.lib/174d7dc67189bc4a53f1bffb4fb9d0f13b79cd3c").lib;
theme = import ./theme.nix args;
in {
options.stylix.targets.gnome.enable =
lib.mkOption {
description = lib.mdDoc "Whether to style GNOME and GDM";
type = lib.types.bool;
default = config.stylix.autoEnable
&& config.services.xserver.desktopManager.gnome.enable;
};
config.lib.stylix.mkEnableTarget "GNOME and GDM" true;
config = lib.mkIf config.stylix.targets.gnome.enable {
config = lib.mkIf (
config.stylix.enable
&& config.stylix.targets.gnome.enable
&& config.services.xserver.desktopManager.gnome.enable
) {
# As Stylix is controlling the wallpaper, there is no need for this
# pack of default wallpapers to be installed.
# If you want to use one, you can set stylix.image to something like

View file

@ -27,19 +27,6 @@ index 5b117ea71..67e7ce756 100644
border-radius: 99px;
padding: $base_padding $base_padding * 2;
diff --git a/data/theme/gnome-shell-sass/_drawing.scss b/data/theme/gnome-shell-sass/_drawing.scss
index 404c4dc81..f006b9347 100644
--- a/data/theme/gnome-shell-sass/_drawing.scss
+++ b/data/theme/gnome-shell-sass/_drawing.scss
@@ -143,7 +143,7 @@
//
// since buttons are all flat an borderless now the mixin is simpler
-@mixin button($t, $tc:$fg_color, $c:$bg_color, $flat: false, $osd: false) {
+@mixin button($t, $tc:$fg_color, $c:$base_color, $flat: false, $osd: false) {
$button_bg_color: mix($tc, $c, $button_mix_factor);
transition-duration: 100ms;
diff --git a/data/theme/gnome-shell-sass/widgets/_calendar.scss b/data/theme/gnome-shell-sass/widgets/_calendar.scss
index fc054da38..8e31741c1 100644
--- a/data/theme/gnome-shell-sass/widgets/_calendar.scss
@ -51,55 +38,3 @@ index fc054da38..8e31741c1 100644
+
+ color: $fg_color !important;
}
/* Calendar */
@@ -220,7 +222,7 @@
.weather-forecast-time {
@extend %numeric;
@extend %caption;
- color: darken($fg_color,30%);
+ color: transparentize($insensitive_fg_color, 0.5);
padding-top: 0.2em;
padding-bottom: 0.4em;
}
diff --git a/data/theme/gnome-shell-sass/widgets/_panel.scss b/data/theme/gnome-shell-sass/widgets/_panel.scss
index 6e7b3be14..3f37fdef5 100644
--- a/data/theme/gnome-shell-sass/widgets/_panel.scss
+++ b/data/theme/gnome-shell-sass/widgets/_panel.scss
@@ -1,11 +1,11 @@
/* Top Bar */
// a.k.a. the panel
-$privacy_indicator_color: $orange_3;
+$privacy_indicator_color: $warning_color;
-$panel_bg_color: if($variant == 'light', $light_3, $dark_5);
-$panel_fg_color: if($variant == 'light', $fg_color, darken($fg_color, 5%));
-$panel_border_color: if($variant == 'light', darken($panel_bg_color, 2%), $panel_bg_color);
+$panel_bg_color: $base_color;
+$panel_fg_color: $fg_color;
+$panel_border_color: transparentize($panel_bg_color, 0.9);
$panel_system_fg_color: $system_fg_color; // always light for lockscreen, overview and other transparent panels
$panel_height: 2.2em;
diff --git a/data/theme/gnome-shell-sass/widgets/_quick-settings.scss b/data/theme/gnome-shell-sass/widgets/_quick-settings.scss
index 723afe7db..b23062294 100644
--- a/data/theme/gnome-shell-sass/widgets/_quick-settings.scss
+++ b/data/theme/gnome-shell-sass/widgets/_quick-settings.scss
@@ -110,13 +110,9 @@
& .icon {
icon-size: $base_icon_size*1.5; // a non-standard symbolic size but ok
border-radius: 999px;
- padding: 1.5 * $base_padding;
- background-color: transparentize($fg_color, 0.8);
-
- &.active {
- background-color: $selected_bg_color;
- color: $selected_fg_color;
- }
+ padding: $base_padding;
+ background-color: $bg_color;
+ color: $fg_color;
}
& .title {

View file

@ -0,0 +1,7 @@
{
services.xserver = {
enable = true;
desktopManager.gnome.enable = true;
displayManager.gdm.enable = true;
};
}

View file

@ -11,7 +11,7 @@ in pkgs.stdenv.mkDerivation {
src = config.lib.stylix.templates.gnome-shell;
patches = [ ./shell_colors.patch ];
postPatch = ''
rm data/theme/gnome-shell-sass/{_colors.scss,_palette.scss}
rm data/theme/gnome-shell-sass/{_colors.scss,_default-colors.scss,_palette.scss}
cp ${colors} data/theme/gnome-shell-sass/_colors.scss
'';

View file

@ -14,8 +14,9 @@ let
} ''
# Use fontconfig to select the correct .ttf or .otf file based on name
font=$(
${pkgs.fontconfig}/bin/fc-match -v "${font.name}" \
| grep "file:" | cut -d '"' -f 2
${lib.getExe' pkgs.fontconfig "fc-match"} \
${lib.escapeShellArg font.name} \
--format=%{file}
)
# Convert to .pf2
@ -27,13 +28,13 @@ in {
enable = config.lib.stylix.mkEnableTarget "GRUB" true;
useImage = lib.mkOption {
description = lib.mdDoc "Whether to use your wallpaper image as the GRUB background.";
description = "Whether to use your wallpaper image as the GRUB background.";
type = lib.types.bool;
default = false;
};
};
config.boot.loader.grub = lib.mkIf config.stylix.targets.grub.enable {
config.boot.loader.grub = lib.mkIf (config.stylix.enable && config.stylix.targets.grub.enable) {
backgroundColor = base00;
# Need to override the NixOS splash, this will match the background
splashImage = pixel "base00";

View file

@ -1,5 +1,5 @@
@define-color accent_color #{{base0A-hex}};
@define-color accent_bg_color #{{base0A-hex}};
@define-color accent_color #{{base0D-hex}};
@define-color accent_bg_color #{{base0D-hex}};
@define-color accent_fg_color #{{base00-hex}};
@define-color destructive_color #{{base08-hex}};
@define-color destructive_bg_color #{{base08-hex}};

View file

@ -21,7 +21,7 @@ in {
"all GTK3, GTK4 and Libadwaita apps" true;
extraCss = mkOption {
description = mdDoc ''
description = ''
Extra code added to `gtk-3.0/gtk.css` and `gtk-4.0/gtk.css`.
'';
type = types.lines;

View file

@ -4,7 +4,7 @@
options.stylix.targets.gtk.enable =
config.lib.stylix.mkEnableTarget "all GTK3, GTK4 and Libadwaita apps" true;
config = lib.mkIf config.stylix.targets.gtk.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.gtk.enable) {
# Required for Home Manager's GTK settings to work
programs.dconf.enable = true;
};

View file

@ -14,9 +14,9 @@ let
in {
options.stylix.targets.helix.enable =
config.lib.stylix.mkEnableTarget "Helix" config.programs.helix.enable;
config.lib.stylix.mkEnableTarget "Helix" true;
config = lib.mkIf config.stylix.targets.helix.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.helix.enable && config.programs.helix.enable) {
programs.helix.settings.theme = "stylix";
xdg.configFile."helix/themes/stylix.toml".source =

View file

@ -9,13 +9,13 @@ let
settings = {
decoration."col.shadow" = rgba base00 "99";
general = {
"col.active_border" = rgb base0A;
"col.active_border" = rgb base0D;
"col.inactive_border" = rgb base03;
};
group = {
"col.border_inactive" = rgb base0D;
"col.border_active" = rgb base06;
"col.border_locked_active" = rgb base06;
"col.border_inactive" = rgb base03;
"col.border_active" = rgb base0D;
"col.border_locked_active" = rgb base0C;
};
misc.background_color = rgb base00;
};
@ -25,5 +25,5 @@ in {
config.lib.stylix.mkEnableTarget "Hyprland" true;
config.wayland.windowManager.hyprland.settings =
lib.mkIf config.stylix.targets.hyprland.enable settings;
lib.mkIf (config.stylix.enable && config.stylix.targets.hyprland.enable) settings;
}

View file

@ -5,7 +5,7 @@ with config.lib.stylix.colors.withHashtag;
let
text = base05;
urgent = base08;
focused = base0A;
focused = base0D;
unfocused = base03;
fonts = let

View file

@ -147,25 +147,33 @@ let
lookAndFeelMetadata = builtins.toJSON lookAndFeelMetadata;
lookAndFeelDefaults = formatConfig lookAndFeelDefaults;
} ''
write_text() {
mkdir --parents "$(dirname "$2")"
printf '%s\n' "$1" >"$2"
}
PATH="${pkgs.imagemagick}/bin:$PATH"
wallpaper="$out/share/wallpapers/stylix"
lookandfeel="$out/share/plasma/look-and-feel/stylix"
look_and_feel="$out/share/plasma/look-and-feel/stylix"
writeText () {
mkdir -p "$(dirname "$2")"
echo "$1" >"$2"
}
mkdir --parents "$wallpaper/contents/images"
magick \
"$wallpaperImage" \
-thumbnail 400x250 \
"$wallpaper/contents/screenshot.png"
mkdir -p "$wallpaper/contents/images"
magick "$wallpaperImage" -thumbnail 400x250 "$wallpaper/contents/screenshot.png"
dimensions="$(identify -ping -format '%wx%h' "$wallpaperImage")"
magick "$wallpaperImage" "$wallpaper/contents/images/$dimensions.png"
writeText "$colorscheme" "$out/share/color-schemes/${colorschemeSlug}.colors"
writeText "$wallpaperMetadata" "$wallpaper/metadata.json"
writeText "$lookAndFeelMetadata" "$lookandfeel/metadata.json"
writeText "$lookAndFeelDefaults" "$lookandfeel/contents/defaults"
write_text \
"$colorscheme" \
"$out/share/color-schemes/${colorschemeSlug}.colors"
write_text "$wallpaperMetadata" "$wallpaper/metadata.json"
write_text "$lookAndFeelMetadata" "$look_and_feel/metadata.json"
write_text "$lookAndFeelDefaults" "$look_and_feel/contents/defaults"
'';
# The cursor theme can be configured through a look and feel package,
@ -206,16 +214,17 @@ let
kdeglobals = formatConfig kdeglobals;
} ''
mkdir "$out"
echo "$kcminputrc" >"$out/kcminputrc"
echo "$kded5rc" >"$out/kded5rc"
echo "$kdeglobals" >"$out/kdeglobals"
printf '%s\n' "$kcminputrc" >"$out/kcminputrc"
printf '%s\n' "$kded5rc" >"$out/kded5rc"
printf '%s\n' "$kdeglobals" >"$out/kdeglobals"
'';
in {
options.stylix.targets.kde.enable =
config.lib.stylix.mkEnableTarget "KDE" pkgs.stdenv.hostPlatform.isLinux;
config.lib.stylix.mkEnableTarget "KDE" true;
config = lib.mkIf config.stylix.targets.kde.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.kde.enable && pkgs.stdenv.hostPlatform.isLinux) {
home.packages = [ themePackage ];
xdg.systemDirs.config = [ "${configPackage}" ];
@ -233,27 +242,29 @@ in {
# changes to KDE to make it possible to update the wallpaper through
# config files alone.
home.activation.stylixLookAndFeel = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
globalPath () {
for dir in /run/current-system/sw/bin /usr/bin /bin; do
if [ -f "$dir/$1" ]; then
echo "$dir/$1"
break
global_path() {
for directory in /run/current-system/sw/bin /usr/bin /bin; do
if [[ -f "$directory/$1" ]]; then
printf '%s\n' "$directory/$1"
return 0
fi
done
return 1
}
wallpaperImage="$(globalPath plasma-apply-wallpaperimage)"
if [ -n "$wallpaperImage" ]; then
"$wallpaperImage" ${themePackage}/share/wallpapers/stylix
if wallpaper_image="$(global_path plasma-apply-wallpaperimage)"; then
"$wallpaper_image" "${themePackage}/share/wallpapers/stylix"
else
echo "Skipping plasma-apply-wallpaperimage because it's not installed"
verboseEcho \
"plasma-apply-wallpaperimage: command not found"
fi
lookAndFeel="$(globalPath plasma-apply-lookandfeel)"
if [ -n "$lookAndFeel" ]; then
"$lookAndFeel" --apply stylix
if look_and_feel="$(global_path plasma-apply-lookandfeel)"; then
"$look_and_feel" --apply stylix
else
echo "Skipping plasma-apply-lookandfeel because it's not installed"
verboseEcho \
"Skipping plasma-apply-lookandfeel: command not found"
fi
'';
};

7
modules/kde/testbed.nix Normal file
View file

@ -0,0 +1,7 @@
{
services.xserver = {
enable = true;
desktopManager.plasma5.enable = true;
displayManager.sddm.enable = true;
};
}

View file

@ -11,7 +11,7 @@ in {
enable = config.lib.stylix.mkEnableTarget "Kitty" true;
variant256Colors = lib.mkOption {
description = lib.mdDoc ''
description = ''
Whether to use the [256-color variant](https://github.com/kdrag0n/base16-kitty#256-color-variants)
rather than the default combination of colors.
'';

View file

@ -3,7 +3,7 @@
options.stylix.targets.kmscon.enable =
config.lib.stylix.mkEnableTarget "the kmscon virtual console" true;
config.services.kmscon = lib.mkIf config.stylix.targets.kmscon.enable {
config.services.kmscon = lib.mkIf (config.stylix.enable && config.stylix.targets.kmscon.enable) {
fonts = [config.stylix.fonts.monospace];
extraConfig =
let

26
modules/lazygit/hm.nix Normal file
View file

@ -0,0 +1,26 @@
{
config,
lib,
...
}: let
colors = config.lib.stylix.colors.withHashtag;
in {
options.stylix.targets.lazygit.enable = config.lib.stylix.mkEnableTarget "lazygit" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.lazygit.enable) {
programs.lazygit.settings.gui.theme = {
activeBorderColor = [
colors.base07
"bold"
];
inactiveBorderColor = [colors.base04];
searchingActiveBorderColor = [colors.base02 "bold"];
optionsTextColor = [colors.base06];
selectedLineBgColor = [colors.base03];
cherryPickedCommitBgColor = [colors.base02];
cherryPickedCommitFgColor = [colors.base03];
unstagedChangesColor = [colors.base08];
defaultFgColor = [colors.base05];
};
};
}

View file

@ -5,5 +5,5 @@
config.lib.stylix.mkEnableTarget "LightDM" true;
config.services.xserver.displayManager.lightdm.background =
lib.mkIf config.stylix.targets.lightdm.enable config.stylix.image;
lib.mkIf (config.stylix.enable && config.stylix.targets.lightdm.enable) config.stylix.image;
}

View file

@ -9,7 +9,7 @@ in {
config.lib.stylix.mkEnableTarget "Mako" true;
# Referenced https://github.com/stacyharper/base16-mako
config = lib.optionalAttrs (options.services ? mako) (lib.mkIf config.stylix.targets.mako.enable {
config = lib.optionalAttrs (options.services ? mako) (lib.mkIf (config.stylix.enable && config.stylix.targets.mako.enable) {
services.mako = {
backgroundColor = base00 + makoOpacity;
borderColor = base0D;

View file

@ -1,24 +1,14 @@
{ config, lib, pkgs, ... }:
{ config, lib, ... }:
let
fonts = config.stylix.fonts;
colors = config.lib.stylix.colors;
opacity = config.stylix.opacity;
copyFont = font:
# Mangohud needs an exact path to the font's .ttf
pkgs.runCommandLocal "mangohud-stylix.ttf" {
FONTCONFIG_FILE =
pkgs.makeFontsConf { fontDirectories = [ font.package ]; };
} ''
font=$(${pkgs.fontconfig}/bin/fc-match -v "${font.name}" | grep "file:" | cut -d '"' -f 2)
cp $font $out
'';
in {
options.stylix.targets.mangohud.enable = config.lib.stylix.mkEnableTarget "mangohud" config.programs.mangohud.enable;
options.stylix.targets.mangohud.enable = config.lib.stylix.mkEnableTarget "mangohud" true;
config = lib.mkIf config.stylix.targets.mangohud.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.mangohud.enable) {
programs.mangohud.settings = with colors; {
font_file = toString (copyFont fonts.sansSerif);
font_size = fonts.sizes.applications;
font_size_text = fonts.sizes.applications;
background_alpha = opacity.popups;
@ -38,7 +28,10 @@ in {
gpu_load_color = "${base0B}, ${base0A}, ${base08}";
cpu_load_color = "${base0B}, ${base0A}, ${base08}";
fps_color = "${base0B}, ${base0A}, ${base08}";
font_scale = 1.33333; # px -> pt conversion
# TODO: Use the point unit:
# https://github.com/danth/stylix/issues/251.
font_scale = 1.33333;
};
};

View file

@ -0,0 +1,25 @@
{ pkgs, config, lib, ... }:
with config.lib.stylix.colors;
{
options.stylix.targets.nixos-icons.enable =
config.lib.stylix.mkEnableTarget "the NixOS logo" true;
config.nixpkgs.overlays = lib.mkIf (config.stylix.enable && config.stylix.targets.nixos-icons.enable) [(self: super: {
nixos-icons = super.nixos-icons.overrideAttrs (oldAttrs: {
src = pkgs.applyPatches {
src = oldAttrs.src;
prePatch = ''
substituteInPlace logo/nix-snowflake-white.svg --replace-fail '#ffffff' '#${base05}'
# Insert attribution comment after the XML prolog
sed \
--in-place \
'2i<!-- The original NixOS logo from ${oldAttrs.src.url} is licensed under https://creativecommons.org/licenses/by/4.0 and has been modified to match the ${scheme} color scheme. -->' \
logo/nix-snowflake-white.svg
'';
};
});
})];
}

View file

@ -6,18 +6,18 @@
}: {
options.stylix.targets.nixvim = {
enable =
config.lib.stylix.mkEnableTarget "nixvim" (config.programs ? nixvim);
config.lib.stylix.mkEnableTarget "nixvim" true;
transparent_bg = {
main = lib.mkEnableOption "background transparency for the main NeoVim window";
sign_column = lib.mkEnableOption "background transparency for the NeoVim sign column";
};
};
config = lib.mkIf ((config.programs ? nixvim) && config.stylix.targets.nixvim.enable) (
config = lib.mkIf (config.stylix.enable && config.stylix.targets.nixvim.enable && (config.programs ? nixvim)) (
lib.optionalAttrs (builtins.hasAttr "nixvim" options.programs) {
programs.nixvim = {
colorschemes.base16 = {
customColorScheme = let
colorscheme = let
colors = config.lib.stylix.colors.withHashtag;
in {
base00 = colors.base00;

View file

@ -4,10 +4,10 @@ with config.lib.stylix.colors.withHashtag;
{
options.stylix.targets.nushell.enable =
config.lib.stylix.mkEnableTarget "Nushell" config.programs.nushell.enable;
config.lib.stylix.mkEnableTarget "Nushell" true;
# Adapted from https://www.nushell.sh/book/coloring_and_theming.html#theming
config.programs.nushell.extraConfig = lib.mkIf config.stylix.targets.nushell.enable ''
config.programs.nushell.extraConfig = lib.mkIf (config.stylix.enable && config.stylix.targets.nushell.enable) ''
$env.config.color_config = {
seperator: "${base03}"
leading_trailing_space_bg: "${base04}"

View file

@ -26,19 +26,9 @@ let
else "cp ${./theme_still.script} $themeDir/stylix.script"
}
${
if cfg.blackBackground
then ''
substituteInPlace $themeDir/stylix.script \
--replace "%BASE00%" "0, 0, 0" \
--replace "%BASE05%" "1, 1, 1"
''
else ''
substituteInPlace $themeDir/stylix.script \
--replace "%BASE00%" "${base00-dec-r}, ${base00-dec-g}, ${base00-dec-b}" \
--replace "%BASE05%" "${base05-dec-r}, ${base05-dec-g}, ${base05-dec-b}"
''
}
substituteInPlace $themeDir/stylix.script \
--replace-fail "%BASE00%" "${base00-dec-r}, ${base00-dec-g}, ${base00-dec-b}" \
--replace-fail "%BASE05%" "${base05-dec-r}, ${base05-dec-g}, ${base05-dec-b}"
echo "
[Plymouth Theme]
@ -56,7 +46,7 @@ in {
enable = config.lib.stylix.mkEnableTarget "the Plymouth boot screen" true;
logo = mkOption {
description = mdDoc "Logo to be used on the boot screen.";
description = "Logo to be used on the boot screen.";
type = with types; either path package;
defaultText = literalMD "NixOS logo";
@ -64,19 +54,13 @@ in {
# files, the SVG file is fetched with `pkgs.fetchurl` to avoid downloading
# the entire repository for a single SVG file.
default = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/master/logo/nix-snowflake.svg";
# Reduce size
postFetch = ''
substituteInPlace $out \
--replace "141.5919" "70.79595" \
--replace "122.80626" "61.40313"
'';
sha256 = "4+MWdqESKo9omd3q0WfRmnrd3Wpe2feiayMnQlA4izU=";
url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/f84c13adae08e860a7c3f76ab3a9bef916d276cc/logo/nix-snowflake-colours.svg";
sha256 = "pHYa+d5f6MAaY8xWd3lDjhagS+nvwDL3w7zSsQyqH7A=";
};
};
logoAnimated = mkOption {
description = mdDoc ''
description = ''
Whether to apply a spinning animation to the logo.
Disabling this allows the use of logos which don't have rotational
@ -85,20 +69,16 @@ in {
type = types.bool;
default = true;
};
blackBackground = mkOption {
description = mdDoc ''
Whether to use a black background rather than a theme colour.
This looks good in combination with systemd-boot, as it means that the
background colour doesn't change throughout the boot process.
'';
type = types.bool;
defaultText = literalMD "`true` if systemd-boot is enabled";
default = config.boot.loader.systemd-boot.enable;
};
};
imports = [
(
lib.mkRemovedOptionModule
[ "stylix" "targets" "plymouth" "blackBackground" ]
"This was removed since it goes against the chosen color scheme. If you want this, consider disabling the target and configuring Plymouth by hand."
)
];
config.boot.plymouth = mkIf cfg.enable {
theme = "stylix";
themePackages = [ theme ];

View file

@ -21,7 +21,7 @@ in {
options.stylix.targets.qutebrowser.enable =
config.lib.stylix.mkEnableTarget "Qutebrowser" true;
config = lib.mkIf config.stylix.targets.qutebrowser.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.qutebrowser.enable) {
programs.qutebrowser.settings = {
colors = {
completion = {

View file

@ -20,7 +20,7 @@ in
options.stylix.targets.rofi.enable =
config.lib.stylix.mkEnableTarget "Rofi" true;
config = lib.mkIf config.stylix.targets.rofi.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.rofi.enable) {
programs.rofi = {
font = "${monospace.name} ${toString sizes.popups}";
theme = {

View file

@ -5,7 +5,7 @@ with config.lib.stylix.colors.withHashtag;
let
text = base05;
urgent = base08;
focused = base0A;
focused = base0D;
unfocused = base03;
fonts = {
@ -18,7 +18,7 @@ in {
config.lib.stylix.mkEnableTarget "Sway" true;
config = lib.mkMerge [
(lib.mkIf config.stylix.targets.sway.enable {
(lib.mkIf (config.stylix.enable && config.stylix.targets.sway.enable) {
wayland.windowManager.sway.config = {
inherit fonts;
@ -54,7 +54,7 @@ in {
};
};
output."*".bg = "${config.stylix.image} fill";
output."*".bg = "${config.stylix.image} ${config.stylix.imageScalingMode}";
seat."*" = {
xcursor_theme = "${config.stylix.cursor.name} ${toString config.stylix.cursor.size}";

View file

@ -12,9 +12,9 @@ let
in {
options.stylix.targets.swaylock = {
enable = config.lib.stylix.mkEnableTarget "Swaylock" pkgs.stdenv.hostPlatform.isLinux;
enable = config.lib.stylix.mkEnableTarget "Swaylock" true;
useImage = lib.mkOption {
description = lib.mdDoc ''
description = ''
Whether to use your wallpaper image for the Swaylock background.
If this is disabled, a plain color will be used instead.
'';
@ -23,36 +23,33 @@ in {
};
};
config = lib.mkIf config.stylix.targets.swaylock.enable
# See https://github.com/danth/stylix/issues/8#issuecomment-1194484544
# This check can be removed when programs.swaylock is in a stable release
(lib.optionalAttrs (options.programs ? swaylock) {
programs.swaylock.settings = {
color = outside;
scaling = "fill";
inside-color = inside;
inside-clear-color = inside;
inside-caps-lock-color = inside;
inside-ver-color = inside;
inside-wrong-color = inside;
key-hl-color = positive;
layout-bg-color = inside;
layout-border-color = ring;
layout-text-color = text;
line-uses-inside = true;
ring-color = ring;
ring-clear-color = negative;
ring-caps-lock-color = ring;
ring-ver-color = positive;
ring-wrong-color = negative;
separator-color = "00000000";
text-color = text;
text-clear-color = text;
text-caps-lock-color = text;
text-ver-color = text;
text-wrong-color = text;
} // lib.optionalAttrs config.stylix.targets.swaylock.useImage {
image = "${config.stylix.image}";
};
});
config = lib.mkIf (config.stylix.enable && config.stylix.targets.swaylock.enable && pkgs.stdenv.hostPlatform.isLinux) {
programs.swaylock.settings = {
color = outside;
scaling = "fill";
inside-color = inside;
inside-clear-color = inside;
inside-caps-lock-color = inside;
inside-ver-color = inside;
inside-wrong-color = inside;
key-hl-color = positive;
layout-bg-color = inside;
layout-border-color = ring;
layout-text-color = text;
line-uses-inside = true;
ring-color = ring;
ring-clear-color = negative;
ring-caps-lock-color = ring;
ring-ver-color = positive;
ring-wrong-color = negative;
separator-color = "00000000";
text-color = text;
text-clear-color = text;
text-caps-lock-color = text;
text-ver-color = text;
text-wrong-color = text;
} // lib.optionalAttrs config.stylix.targets.swaylock.useImage {
image = "${config.stylix.image}";
};
};
}

View file

@ -7,7 +7,7 @@ in {
options.stylix.targets.sxiv.enable =
config.lib.stylix.mkEnableTarget "Sxiv" true;
config = lib.mkIf config.stylix.targets.sxiv.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.sxiv.enable) {
xresources = {
properties = {
"Sxiv.foreground" = "#${colors.base01}";

View file

@ -7,9 +7,9 @@ let
in {
options.stylix.targets.tmux.enable =
config.lib.stylix.mkEnableTarget "Tmux" config.programs.tmux.enable;
config.lib.stylix.mkEnableTarget "Tmux" true;
config = lib.mkIf config.stylix.targets.tmux.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.tmux.enable) {
programs.tmux.extraConfig = ''
source-file ${theme}
'';

37
modules/tofi/hm.nix Normal file
View file

@ -0,0 +1,37 @@
{ config
, lib
, ...
}:
with config.stylix.fonts;
with config.lib.stylix.colors.withHashtag; {
options.stylix.targets.tofi.enable =
config.lib.stylix.mkEnableTarget "Tofi" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.tofi.enable) {
programs.tofi.settings =
let
opacity = lib.toHexString ((((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100));
background = base00 + opacity;
foreground = base05;
darkForeground = base04 + opacity;
selection = base03 + opacity;
in
{
font = monospace.name;
font-size = toString sizes.popups;
background-color = background;
outline-color = darkForeground;
border-color = foreground;
text-color = foreground;
prompt-color = base0A;
prompt-background = background;
placeholder-color = selection;
input-background = background;
default-result-background = background;
selection-color = selection;
selection-background = background;
border-width = lib.mkDefault 4;
outline-width = lib.mkDefault 2;
};
};
}

16
modules/vesktop/hm.nix Normal file
View file

@ -0,0 +1,16 @@
{ config, lib, ... }:
let
themeFile = config.lib.stylix.colors {
template = ./template.mustache;
extension = ".css";
};
in
{
options.stylix.targets.vesktop.enable = config.lib.stylix.mkEnableTarget "Vesktop" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.vesktop.enable) {
home.file."${config.xdg.configHome}/vesktop/themes/stylix.theme.css" = {
source = themeFile;
};
};
}

View file

@ -0,0 +1,57 @@
/**
* @name Stylix
* @author Stylix
* @version 0.0.0
* @description Theme configured via NixOS or Home Manager.
**/
:root {
--base00: #{{base00-hex}}; /* Black */
--base01: #{{base01-hex}}; /* Bright Black */
--base02: #{{base02-hex}}; /* Grey */
--base03: #{{base03-hex}}; /* Brighter Grey */
--base04: #{{base04-hex}}; /* Bright Grey */
--base05: #{{base05-hex}}; /* White */
--base06: #{{base06-hex}}; /* Brighter White */
--base07: #{{base07-hex}}; /* Bright White */
--base08: #{{base08-hex}}; /* Red */
--base09: #{{base09-hex}}; /* Orange */
--base0A: #{{base0A-hex}}; /* Yellow */
--base0B: #{{base0B-hex}}; /* Green */
--base0C: #{{base0C-hex}}; /* Cyan */
--base0D: #{{base0D-hex}}; /* Blue */
--base0E: #{{base0E-hex}}; /* Purple */
--base0F: #{{base0F-hex}}; /* Magenta */
--primary-630: var(--base00); /* Autocomplete background */
--primary-660: var(--base00); /* Search input background */
}
.theme-light, .theme-dark {
--search-popout-option-fade: none; /* Disable fade for search popout */
--bg-overlay-2: var(--base00); /* These 2 are needed for proper threads coloring */
--home-background: var(--base00);
--background-primary: var(--base00);
--background-secondary: var(--base01);
--background-secondary-alt: var(--base01);
--channeltextarea-background: var(--base01);
--background-tertiary: var(--base00);
--background-accent: var(--base0E);
--background-floating: var(--base01);
--background-modifier-hover: #{{base00-hex}}4c; /* 30% of base00 */
--background-modifier-selected: var(--base00);
--text-normal: var(--base05);
--text-secondary: var(--base00);
--text-muted: var(--base03);
--text-link: var(--base0C);
--interactive-normal: var(--base05);
--interactive-hover: var(--base05);
--interactive-active: var(--base07);
--interactive-muted: var(--base03);
--channels-default: var(--base04);
--channel-icon: var(--base04);
--header-primary: var(--base06);
--header-secondary: var(--base03);
--scrollbar-thin-track: transparent;
--scrollbar-auto-track: transparent;
}

View file

@ -23,10 +23,30 @@ let
fonts = config.stylix.fonts;
in {
plugins = [ themePlugin ];
extraConfig = ''
extraConfig = with config.lib.stylix.colors.withHashtag; ''
set termguicolors
colorscheme base16-stylix
unlet g:colors_name
let g:stylix_colors = {
\ 'base00': '${base00}',
\ 'base01': '${base01}',
\ 'base02': '${base02}',
\ 'base03': '${base03}',
\ 'base04': '${base04}',
\ 'base05': '${base05}',
\ 'base06': '${base06}',
\ 'base07': '${base07}',
\ 'base08': '${base08}',
\ 'base09': '${base09}',
\ 'base0A': '${base0A}',
\ 'base0B': '${base0B}',
\ 'base0C': '${base0C}',
\ 'base0D': '${base0D}',
\ 'base0E': '${base0E}',
\ 'base0F': '${base0F}',
\ }
set guifont=${escape [" "] fonts.monospace.name}:h${toString fonts.sizes.terminal}
'';
};
@ -35,7 +55,7 @@ in {
options.stylix.targets.vim.enable =
config.lib.stylix.mkEnableTarget "Vim and/or Neovim" true;
config = lib.mkIf config.stylix.targets.vim.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.vim.enable) {
programs.vim = vimOptions;
programs.neovim = vimOptions;
};

View file

@ -22,7 +22,7 @@ in {
options.stylix.targets.vscode.enable =
config.lib.stylix.mkEnableTarget "VSCode" true;
config = lib.mkIf config.stylix.targets.vscode.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.vscode.enable) {
programs.vscode = {
extensions = [ themeExtension ];
userSettings = {

View file

@ -1,42 +1,58 @@
// Modified from https://github.com/golf1052/base16-generator/blob/f34ab4e68d957900bd28b9c2ade3a6ff5598de91/builder/templates/vscode/templates/default.mustache
{
"$schema": "vscode://schemas/color-theme",
"name": "{{scheme-name}}",
"type": "dark",
"colors": {
"contrastActiveBorder": null,
"contrastBorder": null,
"focusBorder": "#{{base0D-hex}}",
"foreground": "#{{base05-hex}}",
"disabledForeground": "#{{base04-hex}}",
"widget.shadow": "#{{base00-hex}}",
"selection.background": "#{{base0D-hex}}",
"descriptionForeground": "#{{base03-hex}}",
"widget.border": "#{{base02-hex}}",
"widget.shadow": "#00000000",
"selection.background": "#{{base02-hex}}",
"descriptionForeground": "#{{base05-hex}}99",
"errorForeground": "#{{base08-hex}}",
"icon.foreground": "#{{base04-hex}}",
"icon.foreground": "#{{base05-hex}}",
"sash.hoverBorder": null,
"window.activeBorder": null,
"window.inactiveBorder": null,
"textBlockQuote.background": "#{{base01-hex}}",
"textBlockQuote.border": "#{{base0D-hex}}",
"textCodeBlock.background": "#{{base00-hex}}",
"textLink.activeForeground": "#{{base0C-hex}}",
"textLink.foreground": "#{{base0D-hex}}",
"textPreformat.foreground": "#{{base0D-hex}}",
"textPreformat.background": null,
"textSeparator.foreground": "#{{base05-hex}}",
"toolbar.hoverBackground": "#{{base02-hex}}",
"toolbar.activeBackground": "#{{base03-hex}}",
"toolbar.hoverOutline": null,
"toolbar.activeBackground": "#{{base02-hex}}",
"button.background": "#{{base0D-hex}}",
"button.foreground": "#{{base07-hex}}",
"button.hoverBackground": "#{{base04-hex}}",
"button.secondaryForeground": "#{{base07-hex}}",
"button.foreground": "#{{base00-hex}}",
"button.border": null,
"button.separator": null,
"button.hoverBackground": "#{{base0D-hex}}C0",
"button.secondaryForeground": "#{{base00-hex}}",
"button.secondaryBackground": "#{{base0E-hex}}",
"button.secondaryHoverBackground": "#{{base04-hex}}",
"button.secondaryHoverBackground": "#{{base0E-hex}}C0",
"checkbox.background": "#{{base00-hex}}",
"checkbox.foreground": "#{{base05-hex}}",
"checkbox.border": null,
"checkbox.selectBackground": null,
"checkbox.selectBorder": null,
"dropdown.background": "#{{base00-hex}}",
"dropdown.listBackground": "#{{base00-hex}}",
"dropdown.border": null,
"dropdown.foreground": "#{{base05-hex}}",
"input.background": "#{{base00-hex}}",
"input.border": null,
"input.foreground": "#{{base05-hex}}",
"input.placeholderForeground": "#{{base03-hex}}",
"inputOption.activeBackground": "#{{base02-hex}}",
"inputOption.activeBorder": "#{{base09-hex}}",
"inputOption.activeForeground": "#{{base05-hex}}",
"inputOption.activeBackground": "#{{base0D-hex}}",
"inputOption.activeBorder": null,
"inputOption.activeForeground": "#{{base00-hex}}",
"inputOption.hoverBackground": null,
"inputValidation.errorBackground": "#{{base08-hex}}",
"inputValidation.errorForeground": "#{{base05-hex}}",
"inputValidation.errorBorder": "#{{base08-hex}}",
@ -46,106 +62,190 @@
"inputValidation.warningBackground": "#{{base0A-hex}}",
"inputValidation.warningForeground": "#{{base05-hex}}",
"inputValidation.warningBorder": "#{{base0A-hex}}",
"scrollbar.shadow": "#{{base01-hex}}",
"scrollbarSlider.activeBackground": "#{{base04-hex}}",
"scrollbarSlider.background": "#{{base02-hex}}",
"scrollbarSlider.hoverBackground": "#{{base03-hex}}",
"badge.background": "#{{base00-hex}}",
"scrollbar.shadow": "#00000000",
"scrollbarSlider.activeBackground": "#{{base04-hex}}77",
"scrollbarSlider.background": "#{{base03-hex}}33",
"scrollbarSlider.hoverBackground": "#{{base03-hex}}77",
"badge.foreground": "#{{base05-hex}}",
"badge.background": "#{{base00-hex}}",
"progressBar.background": "#{{base03-hex}}",
"list.activeSelectionBackground": "#{{base02-hex}}",
"list.activeSelectionForeground": "#{{base05-hex}}",
"list.dropBackground": "#{{base07-hex}}",
"list.activeSelectionIconForeground": null,
"list.dropBackground": "#{{base03-hex}}66",
"list.focusBackground": "#{{base02-hex}}",
"list.focusForeground": "#{{base05-hex}}",
"list.focusHighlightForeground": null,
"list.focusOutline": "#{{base0D-hex}}",
"list.focusAndSelectionOutline": "#{{base0D-hex}}",
"list.highlightForeground": "#{{base07-hex}}",
"list.hoverBackground": "#{{base02-hex}}",
"list.hoverForeground": "#{{base05-hex}}",
"list.inactiveSelectionBackground": "#{{base02-hex}}",
"list.inactiveSelectionForeground": "#{{base05-hex}}",
"list.inactiveSelectionIconForeground": null,
"list.inactiveFocusBackground": "#{{base02-hex}}",
"list.inactiveFocusOutline": "#{{base03-hex}}",
"list.invalidItemForeground": "#{{base08-hex}}",
"list.errorForeground": "#{{base08-hex}}",
"list.warningForeground": "#{{base0A-hex}}",
"listFilterWidget.background": "#{{base00-hex}}",
"listFilterWidget.outline": null,
"listFilterWidget.noMatchesOutline": "#{{base08-hex}}",
"listFilterWidget.shadow": "#00000000",
"list.filterMatchBackground": "#{{base02-hex}}",
"list.filterMatchBorder": null,
"list.deemphasizedForeground": null,
"list.dropBetweenBackground": null,
"tree.indentGuidesStroke": "#{{base05-hex}}",
"tree.inactiveIndentGuidesStroke": null,
"tree.tableColumnsBorder": null,
"tree.tableOddRowsBackground": null,
"activityBar.background": "#{{base01-hex}}",
"activityBar.dropBackground": "#{{base07-hex}}",
"activityBar.dropBorder": "#{{base03-hex}}",
"activityBar.foreground": "#{{base05-hex}}",
"activityBar.inactiveForeground": "#{{base03-hex}}",
"activityBar.border": null,
"activityBarBadge.background": "#{{base0D-hex}}",
"activityBarBadge.foreground": "#{{base07-hex}}",
"activityBarBadge.foreground": "#{{base00-hex}}",
"activityBar.activeBorder": "#{{base05-hex}}",
"activityBar.activeBackground": "#{{base02-hex}}",
"activityBar.activeFocusBorder": "#{{base0D-hex}}",
"activityBarTop.foreground": "#{{base05-hex}}",
"activityBarTop.activeBorder": "#{{base0D-hex}}",
"activityBarTop.inactiveForeground": "#{{base03-hex}}",
"activityBarTop.dropBorder": "#{{base03-hex}}",
"profileBadge.background": "#{{base01-hex}}",
"profileBadge.foreground": "#{{base03-hex}}",
"sideBar.background": "#{{base01-hex}}",
"sideBar.foreground": "#{{base05-hex}}",
"sideBar.border": null,
"sideBar.dropBackground": "#{{base02-hex}}",
"sideBarTitle.foreground": "#{{base05-hex}}",
"sideBarSectionHeader.background": "#{{base01-hex}}",
"sideBarSectionHeader.foreground": "#{{base05-hex}}",
"sideBarSectionHeader.border": null,
"minimap.findMatchHighlight": "#{{base0A-hex}}",
"minimap.selectionHighlight": "#{{base02-hex}}",
"minimap.errorHighlight": "#{{base08-hex}}",
"minimap.warningHighlight": "#{{base0A-hex}}",
"minimap.background": "#{{base00-hex}}",
"minimap.selectionOccurrenceHighlight": "#{{base03-hex}}",
"minimap.foregroundOpacity": null,
"minimap.infoHighlight": null,
"minimapSlider.background": null,
"minimapSlider.hoverBackground": null,
"minimapSlider.activeBackground": null,
"minimapGutter.addedBackground": "#{{base0B-hex}}",
"minimapGutter.modifiedBackground": "#{{base0E-hex}}",
"minimapGutter.deletedBackground": "#{{base08-hex}}",
"editorGroup.background": "#{{base00-hex}}",
"editorGroup.dropBackground": "#{{base02-hex}}",
"editorGroup.border": null,
"editorGroup.dropBackground": "#{{base03-hex}}66",
"editorGroupHeader.noTabsBackground": "#{{base01-hex}}",
"editorGroupHeader.tabsBackground": "#{{base01-hex}}",
"editorGroupHeader.tabsBorder": null,
"editorGroupHeader.border": null,
"editorGroup.emptyBackground": "#{{base00-hex}}",
"editorGroup.focusedEmptyBorder": "#{{base0D-hex}}",
"editorGroup.dropIntoPromptForeground": "#{{base06-hex}}",
"editorGroup.dropIntoPromptBackground": "#{{base00-hex}}",
"editorGroup.dropIntoPromptBorder": null,
"tab.activeBackground": "#{{base02-hex}}",
"tab.unfocusedActiveBackground": "#{{base02-hex}}",
"tab.activeForeground": "#{{base05-hex}}",
"tab.border": "#00000000",
"tab.activeBorder": null,
"tab.dragAndDropBorder": "#${{base03-hex}}",
"tab.unfocusedActiveBorder": null,
"tab.activeBorderTop": null,
"tab.unfocusedActiveBorderTop": null,
"tab.lastPinnedBorder": null,
"tab.inactiveBackground": "#{{base01-hex}}",
"tab.unfocusedInactiveBackground": "#{{base01-hex}}",
"tab.inactiveForeground": "#{{base05-hex}}",
"tab.unfocusedActiveForeground": "#{{base04-hex}}",
"tab.unfocusedInactiveForeground": "#{{base04-hex}}",
"tab.hoverBackground": "#{{base02-hex}}",
"tab.unfocusedHoverBackground": "#{{base02-hex}}",
"tab.hoverForeground": "#{{base05-hex}}",
"tab.unfocusedHoverForeground": "#{{base05-hex}}",
"tab.hoverBorder": null,
"tab.unfocusedHoverBorder": null,
"tab.activeModifiedBorder": "#{{base0D-hex}}",
"tab.inactiveModifiedBorder": "#{{base0D-hex}}",
"tab.unfocusedActiveModifiedBorder": "#{{base0D-hex}}",
"tab.unfocusedInactiveModifiedBorder": "#{{base0D-hex}}",
"editorPane.background": "#{{base00-hex}}",
"sideBySideEditor.horizontalBorder": null,
"sideBySideEditor.verticalBorder": null,
"editor.background": "#{{base00-hex}}",
"editor.foreground": "#{{base05-hex}}",
"editorLineNumber.foreground": "#{{base03-hex}}",
"editorLineNumber.activeForeground": "#{{base04-hex}}",
"editorLineNumber.dimmedForeground": null,
"editorCursor.background": null,
"editorCursor.foreground": "#{{base05-hex}}",
"editor.selectionBackground": "#{{base02-hex}}",
"editor.selectionForeground": null,
"editor.inactiveSelectionBackground": "#{{base02-hex}}",
"editor.selectionHighlightBackground": "#{{base01-hex}}",
"editor.selectionHighlightBorder": null,
"editor.wordHighlightBackground": "#{{base02-hex}}",
"editor.wordHighlightBorder": null,
"editor.wordHighlightStrongBackground": "#{{base03-hex}}",
"editor.wordHighlightStrongBorder": null,
"editor.wordHighlightTextBackground": null,
"editor.wordHighlightTextBorder": null,
"editor.findMatchBackground": "#{{base0A-hex}}",
"editor.findMatchHighlightBackground": "#{{base09-hex}}",
"editor.findRangeHighlightBackground": "#{{base01-hex}}",
"editor.findMatchBorder": null,
"editor.findMatchHighlightBorder": null,
"editor.findRangeHighlightBorder": null,
"search.resultsInfoForeground": null,
"searchEditor.findMatchBackground": "#{{base0A-hex}}",
"searchEditor.findMatchBorder": null,
"searchEditor.textInputBorder": null,
"editor.hoverHighlightBackground": "#{{base02-hex}}",
"editor.lineHighlightBackground": "#{{base01-hex}}",
"editor.lineHighlightBorder": null,
"editorWatermark.foreground": null,
"editorUnicodeHighlight.border": null,
"editorUnicodeHighlight.background": null,
"editorLink.activeForeground": "#{{base0D-hex}}",
"editor.rangeHighlightBackground": "#{{base01-hex}}",
"editor.rangeHighlightBorder": null,
"editor.symbolHighlightBackground": null,
"editor.symbolHighlightBorder": null,
"editorWhitespace.foreground": "#{{base03-hex}}",
"editorIndentGuide.background": "#{{base03-hex}}",
"editorIndentGuide.activeBackground": "#{{base04-hex}}",
"editorIndentGuide.background": "#{{base02-hex}}",
"editorIndentGuide.background1": null,
"editorIndentGuide.background2": null,
"editorIndentGuide.background3": null,
"editorIndentGuide.background4": null,
"editorIndentGuide.background5": null,
"editorIndentGuide.background6": null,
"editorIndentGuide.activeBackground": "#{{base02-hex}}",
"editorIndentGuide.activeBackground1": null,
"editorIndentGuide.activeBackground2": null,
"editorIndentGuide.activeBackground3": null,
"editorIndentGuide.activeBackground4": null,
"editorIndentGuide.activeBackground5": null,
"editorIndentGuide.activeBackground6": null,
"editorInlayHint.background": "#{{base01-hex}}",
"editorInlayHint.foreground": "#{{base05-hex}}",
"editorInlayHint.foreground": "#{{base03-hex}}",
"editorInlayHint.typeForeground": "#{{base03-hex}}",
"editorInlayHint.typeBackground": "#{{base01-hex}}",
"editorInlayHint.typeForeground": "#{{base05-hex}}",
"editorInlayHint.parameterForeground": "#{{base03-hex}}",
"editorInlayHint.parameterBackground": "#{{base01-hex}}",
"editorInlayHint.parameterForeground": "#{{base05-hex}}",
"editorRuler.foreground": "#{{base03-hex}}",
"editorRuler.foreground": "#{{base02-hex}}",
"editor.linkedEditingBackground": null,
"editorCodeLens.foreground": "#{{base02-hex}}",
"editorLightBulb.foreground": "#{{base0A-hex}}",
"editorLightBulbAutoFix.foreground": "#{{base0D-hex}}",
"editorLightBulbAi.foreground": null,
"editorBracketMatch.background": "#{{base02-hex}}",
"editorBracketMatch.border": null,
"editorBracketHighlight.foreground1": "#{{base08-hex}}",
"editorBracketHighlight.foreground2": "#{{base09-hex}}",
"editorBracketHighlight.foreground3": "#{{base0A-hex}}",
@ -153,11 +253,27 @@
"editorBracketHighlight.foreground5": "#{{base0D-hex}}",
"editorBracketHighlight.foreground6": "#{{base0E-hex}}",
"editorBracketHighlight.unexpectedBracket.foreground": "#{{base0F-hex}}",
"editorBracketPairGuide.activeBackground1": null,
"editorBracketPairGuide.activeBackground2": null,
"editorBracketPairGuide.activeBackground3": null,
"editorBracketPairGuide.activeBackground4": null,
"editorBracketPairGuide.activeBackground5": null,
"editorBracketPairGuide.activeBackground6": null,
"editorBracketPairGuide.background1": null,
"editorBracketPairGuide.background2": null,
"editorBracketPairGuide.background3": null,
"editorBracketPairGuide.background4": null,
"editorBracketPairGuide.background5": null,
"editorBracketPairGuide.background6": null,
"editor.foldBackground": null,
"editorOverviewRuler.background": null,
"editorOverviewRuler.border": "#00000000",
"editorOverviewRuler.findMatchForeground": "#{{base0A-hex}}",
"editorOverviewRuler.rangeHighlightForeground": "#{{base03-hex}}",
"editorOverviewRuler.selectionHighlightForeground": "#{{base02-hex}}",
"editorOverviewRuler.wordHighlightForeground": "#{{base07-hex}}",
"editorOverviewRuler.wordHighlightStrongForeground": "#{{base0D-hex}}",
"editorOverviewRuler.wordHighlightTextForeground": null,
"editorOverviewRuler.modifiedForeground": "#{{base0E-hex}}",
"editorOverviewRuler.addedForeground": "#{{base0B-hex}}",
"editorOverviewRuler.deletedForeground": "#{{base08-hex}}",
@ -165,33 +281,103 @@
"editorOverviewRuler.warningForeground": "#{{base0A-hex}}",
"editorOverviewRuler.infoForeground": "#{{base0C-hex}}",
"editorOverviewRuler.bracketMatchForeground": "#{{base06-hex}}",
"editorOverviewRuler.inlineChatInserted": null,
"editorOverviewRuler.inlineChatRemoved": null,
"editorError.foreground": "#{{base08-hex}}",
"editorError.border": null,
"editorError.background": null,
"editorWarning.foreground": "#{{base0A-hex}}",
"editorWarning.border": null,
"editorWarning.background": null,
"editorInfo.foreground": "#{{base0C-hex}}",
"editorInfo.border": null,
"editorInfo.background": null,
"editorHint.foreground": "#{{base0D-hex}}",
"editorHint.border": null,
"problemsErrorIcon.foreground": "#{{base08-hex}}",
"problemsWarningIcon.foreground": "#{{base0A-hex}}",
"problemsInfoIcon.foreground": "#{{base0C-hex}}",
"editorUnnecessaryCode.border": null,
"editorUnnecessaryCode.opacity": null,
"editorGutter.background": "#{{base00-hex}}",
"editorGutter.modifiedBackground": "#{{base0E-hex}}",
"editorGutter.addedBackground": "#{{base0B-hex}}",
"editorGutter.deletedBackground": "#{{base08-hex}}",
"editorGutter.commentRangeForeground": "#{{base04-hex}}",
"editorGutter.commentGlyphForeground": null,
"editorGutter.commentUnresolvedGlyphForeground": null,
"editorGutter.foldingControlForeground": "#{{base05-hex}}",
"diffEditor.insertedTextBackground": "#{{base0B-hex}}20",
"diffEditor.removedTextBackground": "#{{base08-hex}}20",
"editorCommentsWidget.resolvedBorder": null,
"editorCommentsWidget.unresolvedBorder": null,
"editorCommentsWidget.rangeBackground": null,
"editorCommentsWidget.rangeActiveBackground": null,
"editorCommentsWidget.replyInputBackground": null,
"diffEditor.insertedTextBackground": "#{{base0B-hex}}4c",
"diffEditor.insertedTextBorder": null,
"diffEditor.removedTextBackground": "#{{base08-hex}}4c",
"diffEditor.removedTextBorder": null,
"diffEditor.border": "#{{base02-hex}}",
"diffEditor.diagonalFill": "#{{base02-hex}}",
"diffEditor.insertedLineBackground": "#{{base0B-hex}}18",
"diffEditor.removedLineBackground": "#{{base08-hex}}18",
"diffEditorGutter.insertedLineBackground": "#{{base0B-hex}}99",
"diffEditorGutter.removedLineBackground": "#{{base08-hex}}99",
"diffEditorOverview.insertedForeground": "#{{base0B-hex}}99",
"diffEditorOverview.removedForeground": "#{{base08-hex}}99",
"diffEditor.unchangedRegionBackground": null,
"diffEditor.unchangedRegionForeground": null,
"diffEditor.unchangedRegionShadow": "#00000000",
"diffEditor.unchangedCodeBackground": null,
"diffEditor.move.border": null,
"diffEditor.moveActive.border": null,
"multiDiffEditor.headerBackground": null,
"multiDiffEditor.background": null,
"multiDiffEditor.border": null,
"chat.requestBorder": "#{{base02-hex}}",
"chat.requestBackground": "#{{base01-hex}}",
"chat.slashCommandBackground": "#{{base0D-hex}}",
"chat.slashCommandForeground": "#{{base00-hex}}",
"chat.avatarBackground": "#{{base0D-hex}}",
"chat.avatarForeground": "#{{base00-hex}}",
"inlineChat.background": "#{{base01-hex}}",
"inlineChat.border": "#{{base02-hex}}",
"inlineChat.shadow": "#00000000",
"inlineChat.regionHighlight": "#{{base01-hex}}",
"inlineChatInput.border": "#{{base02-hex}}",
"inlineChatInput.focusBorder": "#{{base0D-hex}}",
"inlineChatInput.placeholderForeground": "#{{base03-hex}}",
"inlineChatInput.background": "#{{base00-hex}}",
"inlineChatDiff.inserted": "#{{base0B-hex}}60",
"inlineChatDiff.removed": "#{{base08-hex}}60",
"interactive.activeCodeBorder": null,
"interactive.inactiveCodeBorder": null,
"editorWidget.foreground": "#{{base05-hex}}",
"editorWidget.background": "#{{base00-hex}}",
"editorWidget.border": "#{{base02-hex}}",
"editorWidget.resizeBorder": "#{{base0D-hex}}",
"editorSuggestWidget.background": "#{{base01-hex}}",
"editorSuggestWidget.border": "#{{base02-hex}}",
"editorSuggestWidget.foreground": "#{{base05-hex}}",
"editorSuggestWidget.focusHighlightForeground": "#{{base07-hex}}",
"editorSuggestWidget.focusHighlightForeground": "#{{base0D-hex}}",
"editorSuggestWidget.highlightForeground": "#{{base0D-hex}}",
"editorSuggestWidget.selectedBackground": "#{{base02-hex}}",
"editorSuggestWidget.selectedForeground": "#{{base06-hex}}",
"editorSuggestWidget.selectedForeground": "#{{base05-hex}}",
"editorSuggestWidget.selectedIconForeground": "#{{base05-hex}}",
"editorSuggestWidgetStatus.foreground": null,
"editorHoverWidget.foreground": "#{{base05-hex}}",
"editorHoverWidget.background": "#{{base00-hex}}",
"editorHoverWidget.background": "#{{base01-hex}}",
"editorHoverWidget.border": "#{{base02-hex}}",
"editorHoverWidget.highlightForeground": "#{{base0D-hex}}",
"editorHoverWidget.statusBarBackground": "#{{base01-hex}}",
"editorGhostText.border": null,
"editorGhostText.background": "#00000000",
"editorGhostText.foreground": "#{{base03-hex}}",
"editorStickyScroll.background": "#{{base00-hex}}",
"editorStickyScroll.border": "#{{base02-hex}}",
"editorStickyScroll.shadow": "#00000000",
"editorStickyScrollHover.background": "#{{base01-hex}}",
"debugExceptionWidget.background": "#{{base01-hex}}",
"debugExceptionWidget.border": null,
"editorMarkerNavigation.background": "#{{base01-hex}}",
"editorMarkerNavigationError.background": "#{{base08-hex}}",
"editorMarkerNavigationWarning.background": "#{{base0A-hex}}",
@ -199,9 +385,11 @@
"editorMarkerNavigationError.headerBackground": "#{{base08-hex}}20",
"editorMarkerNavigationWarning.headerBackground": "#{{base0A-hex}}20",
"editorMarkerNavigationInfo.headerBackground": "#{{base0C-hex}}20",
"peekView.border": null,
"peekViewEditor.background": "#{{base01-hex}}",
"peekViewEditorGutter.background": "#{{base01-hex}}",
"peekViewEditor.matchHighlightBackground": "#{{base09-hex}}",
"peekViewEditor.matchHighlightBorder": null,
"peekViewResult.background": "#{{base00-hex}}",
"peekViewResult.fileForeground": "#{{base05-hex}}",
"peekViewResult.lineForeground": "#{{base03-hex}}",
@ -211,112 +399,192 @@
"peekViewTitle.background": "#{{base02-hex}}",
"peekViewTitleDescription.foreground": "#{{base03-hex}}",
"peekViewTitleLabel.foreground": "#{{base05-hex}}",
"merge.currentContentBackground": "#{{base0D-hex}}40",
"merge.currentHeaderBackground": "#{{base0D-hex}}40",
"merge.incomingContentBackground": "#{{base0B-hex}}60",
"merge.incomingHeaderBackground": "#{{base0B-hex}}60",
"peekViewEditorStickyScroll.background": null,
"merge.currentHeaderBackground": "#{{base0D-hex}}66",
"merge.currentContentBackground": "#{{base0D-hex}}18",
"merge.incomingHeaderBackground": "#{{base0B-hex}}66",
"merge.incomingContentBackground": "#{{base0B-hex}}18",
"merge.border": null,
"merge.commonContentBackground": null,
"merge.commonHeaderBackground": null,
"editorOverviewRuler.currentContentForeground": "#{{base0D-hex}}",
"editorOverviewRuler.incomingContentForeground": "#{{base0B-hex}}",
"editorOverviewRuler.commonContentForeground": "#{{base0F-hex}}",
"panel.background": "#{{base00-hex}}",
"panel.dropBackground": "#{{base01-hex}}",
"editorOverviewRuler.commentForeground": null,
"editorOverviewRuler.commentUnresolvedForeground": null,
"mergeEditor.change.background": null,
"mergeEditor.change.word.background": null,
"mergeEditor.conflict.unhandledUnfocused.border": null,
"mergeEditor.conflict.unhandledFocused.border": "#{{base0D-hex}}",
"mergeEditor.conflict.handledUnfocused.border": null,
"mergeEditor.conflict.handledFocused.border": "#{{base0D-hex}}",
"mergeEditor.conflict.handled.minimapOverViewRuler": null,
"mergeEditor.conflict.unhandled.minimapOverViewRuler": null,
"mergeEditor.conflictingLines.background": null,
"mergeEditor.changeBase.background": null,
"mergeEditor.changeBase.word.background": null,
"mergeEditor.conflict.input1.background": null,
"mergeEditor.conflict.input2.background": null,
"panel.background": "#{{base01-hex}}",
"panel.border": "#00000000",
"panel.dropBorder": "#{{base01-hex}}",
"panelTitle.activeBorder": null,
"panelTitle.activeForeground": "#{{base05-hex}}",
"panelTitle.inactiveForeground": "#{{base03-hex}}",
"statusBar.background": "#{{base0D-hex}}",
"statusBar.foreground": "#{{base07-hex}}",
"panelInput.border": null,
"panelSection.border": null,
"panelSection.dropBackground": null,
"panelSectionHeader.background": null,
"panelSectionHeader.foreground": null,
"panelSectionHeader.border": null,
"outputView.background": null,
"outputViewStickyScroll.background": null,
"statusBar.background": "#{{base01-hex}}",
"statusBar.foreground": "#{{base05-hex}}",
"statusBar.border": null,
"statusBar.debuggingBackground": "#{{base09-hex}}",
"statusBar.debuggingForeground": "#{{base07-hex}}",
"statusBar.noFolderBackground": "#{{base0E-hex}}",
"statusBar.noFolderForeground": "#{{base07-hex}}",
"statusBarItem.activeBackground": "#{{base03-hex}}",
"statusBar.debuggingForeground": "#{{base00-hex}}",
"statusBar.debuggingBorder": null,
"statusBar.noFolderForeground": "#{{base05-hex}}",
"statusBar.noFolderBackground": "#{{base01-hex}}",
"statusBar.noFolderBorder": null,
"statusBarItem.activeBackground": "#{{base02-hex}}",
"statusBarItem.hoverForeground": "#{{base05-hex}}",
"statusBarItem.hoverBackground": "#{{base02-hex}}",
"statusBarItem.prominentForeground": "#{{base07-hex}}",
"statusBarItem.prominentForeground": "#{{base00-hex}}",
"statusBarItem.prominentBackground": "#{{base0E-hex}}",
"statusBarItem.prominentHoverBackground": "#{{base08-hex}}",
"statusBarItem.remoteBackground": "#{{base0B-hex}}",
"statusBarItem.remoteForeground": "#{{base07-hex}}",
"statusBarItem.prominentHoverForeground": "#{{base00-hex}}",
"statusBarItem.prominentHoverBackground": "#{{base0E-hex}}C0",
"statusBarItem.remoteBackground": "#{{base01-hex}}",
"statusBarItem.remoteForeground": "#{{base05-hex}}",
"statusBarItem.remoteHoverBackground": "#{{base02-hex}}",
"statusBarItem.remoteHoverForeground": "#{{base05-hex}}",
"statusBarItem.errorBackground": "#{{base08-hex}}",
"statusBarItem.errorForeground": "#{{base07-hex}}",
"statusBarItem.errorForeground": "#{{base00-hex}}",
"statusBarItem.errorHoverBackground": "#{{base08-hex}}C0",
"statusBarItem.errorHoverForeground": "#{{base00-hex}}",
"statusBarItem.warningBackground": "#{{base0A-hex}}",
"statusBarItem.warningForeground": "#{{base07-hex}}",
"statusBarItem.warningForeground": "#{{base00-hex}}",
"statusBarItem.warningHoverBackground": "#{{base0A-hex}}C0",
"statusBarItem.warningHoverForeground": "#{{base00-hex}}",
"statusBarItem.compactHoverBackground": "#{{base02-hex}}",
"statusBarItem.focusBorder": "#{{base0D-hex}}",
"statusBar.focusBorder": "#{{base0D-hex}}",
"statusBarItem.offlineBackground": "#{{base09-hex}}",
"statusBarItem.offlineForeground": "#{{base00-hex}}",
"statusBarItem.offlineHoverForeground": "#{{base00-hex}}",
"statusBarItem.offlineHoverBackground": "#{{base09-hex}}C0",
"titleBar.activeBackground": "#{{base00-hex}}",
"titleBar.activeForeground": "#{{base05-hex}}",
"titleBar.inactiveBackground": "#{{base01-hex}}",
"titleBar.inactiveForeground": "#{{base03-hex}}",
"titleBar.border": null,
"menubar.selectionForeground": "#{{base05-hex}}",
"menubar.selectionBackground": "#{{base01-hex}}",
"menubar.selectionBorder": null,
"menu.foreground": "#{{base05-hex}}",
"menu.background": "#{{base01-hex}}",
"menu.selectionForeground": "#{{base05-hex}}",
"menu.selectionBackground": "#{{base02-hex}}",
"menu.separatorBackground": "#{{base07-hex}}",
"menu.selectionBorder": null,
"menu.separatorBackground": "#{{base02-hex}}",
"menu.border": "#{{base02-hex}}",
"commandCenter.foreground": "#{{base05-hex}}",
"commandCenter.activeForeground": "#{{base07-hex}}",
"commandCenter.background": "#{{base00-hex}}",
"commandCenter.activeBackground": "#{{base01-hex}}",
"commandCenter.border": null,
"commandCenter.inactiveForeground": null,
"commandCenter.inactiveBorder": null,
"commandCenter.activeBorder": null,
"commandCenter.debuggingBackground": null,
"notificationCenter.border": null,
"notificationCenterHeader.foreground": "#{{base05-hex}}",
"notificationCenterHeader.background": "#{{base01-hex}}",
"notificationToast.border": null,
"notifications.foreground": "#{{base05-hex}}",
"notifications.background": "#{{base02-hex}}",
"notifications.border": null,
"notificationLink.foreground": "#{{base0D-hex}}",
"notificationsErrorIcon.foreground": "#{{base08-hex}}",
"notificationsWarningIcon.foreground": "#{{base0A-hex}}",
"notificationsInfoIcon.foreground": "#{{base0D-hex}}",
"notification.background": "#{{base02-hex}}",
"notification.foreground": "#{{base05-hex}}",
"notification.buttonBackground": "#{{base0D-hex}}",
"notification.buttonHoverBackground": "#{{base02-hex}}",
"notification.buttonForeground": "#{{base07-hex}}",
"notification.infoBackground": "#{{base0C-hex}}",
"notification.infoForeground": "#{{base07-hex}}",
"notification.warningBackground": "#{{base0A-hex}}",
"notification.warningForeground": "#{{base07-hex}}",
"notification.errorBackground": "#{{base08-hex}}",
"notification.errorForeground": "#{{base07-hex}}",
"banner.background": "#{{base02-hex}}",
"banner.foreground": "#{{base05-hex}}",
"banner.iconForeground": "#{{base0D-hex}}",
"extensionButton.prominentForeground": "#{{base00-hex}}",
"extensionButton.prominentBackground": "#{{base0B-hex}}",
"extensionButton.prominentForeground": "#{{base07-hex}}",
"extensionButton.prominentHoverBackground": "#{{base02-hex}}",
"extensionButton.prominentHoverBackground": "#{{base0B-hex}}C0",
"extensionButton.background": "#{{base0D-hex}}",
"extensionButton.foreground": "#{{base00-hex}}",
"extensionButton.hoverBackground": "#{{base0D-hex}}C0",
"extensionButton.separator": "#00000000",
"extensionBadge.remoteBackground": "#{{base09-hex}}",
"extensionBadge.remoteForeground": "#{{base07-hex}}",
"extensionIcon.starForeground": "#{{base0A-hex}}",
"extensionIcon.verifiedForeground": "#{{base0D-hex}}",
"extensionIcon.preReleaseForeground": "#{{base09-hex}}",
"extensionIcon.sponsorForeground": null,
"pickerGroup.border": "#{{base02-hex}}",
"pickerGroup.foreground": "#{{base03-hex}}",
"quickInput.background": "#{{base01-hex}}",
"quickInput.foreground": "#{{base05-hex}}",
"quickInputList.focusBackground": "#{{base03-hex}}",
"quickInputList.focusForeground": "#{{base07-hex}}",
"quickInputList.focusIconForeground": "#{{base07-hex}}",
"quickInputList.focusBackground": "#{{base02-hex}}",
"quickInputList.focusForeground": "#{{base05-hex}}",
"quickInputList.focusIconForeground": "#{{base05-hex}}",
"quickInputTitle.background": "#{{base01-hex}}",
"keybindingLabel.background": "#{{base02-hex}}",
"keybindingLabel.foreground": "#{{base05-hex}}",
"keybindingLabel.border": null,
"keybindingLabel.bottomBorder": "#{{base02-hex}}",
"keybindingTable.headerBackground": "#{{base02-hex}}",
"keybindingTable.rowsBackground": "#{{base01-hex}}",
"terminal.background": "#{{base00-hex}}",
"terminal.border": null,
"terminal.foreground": "#{{base05-hex}}",
"terminal.ansiBlack": "#{{base00-hex}}",
"terminal.ansiRed": "#{{base08-hex}}",
"terminal.ansiGreen": "#{{base0B-hex}}",
"terminal.ansiYellow": "#{{base0A-hex}}",
"terminal.ansiBlue": "#{{base0D-hex}}",
"terminal.ansiMagenta": "#{{base0E-hex}}",
"terminal.ansiCyan": "#{{base0C-hex}}",
"terminal.ansiWhite": "#{{base05-hex}}",
"terminal.ansiBrightBlack": "#{{base03-hex}}",
"terminal.ansiBrightRed": "#{{base08-hex}}",
"terminal.ansiBrightGreen": "#{{base0B-hex}}",
"terminal.ansiBrightYellow": "#{{base0A-hex}}",
"terminal.ansiBrightBlue": "#{{base0D-hex}}",
"terminal.ansiBrightMagenta": "#{{base0E-hex}}",
"terminal.ansiBrightCyan": "#{{base0C-hex}}",
"terminal.ansiBrightGreen": "#{{base0B-hex}}",
"terminal.ansiBrightMagenta": "#{{base0E-hex}}",
"terminal.ansiBrightRed": "#{{base08-hex}}",
"terminal.ansiBrightWhite": "#{{base07-hex}}",
"terminal.ansiBrightYellow": "#{{base0A-hex}}",
"terminal.ansiCyan": "#{{base0C-hex}}",
"terminal.ansiGreen": "#{{base0B-hex}}",
"terminal.ansiMagenta": "#{{base0E-hex}}",
"terminal.ansiRed": "#{{base08-hex}}",
"terminal.ansiWhite": "#{{base05-hex}}",
"terminal.ansiYellow": "#{{base0A-hex}}",
"terminal.selectionBackground": null,
"terminal.selectionForeground": null,
"terminal.inactiveSelectionBackground": null,
"terminal.findMatchBackground": null,
"terminal.findMatchBorder": null,
"terminal.findMatchHighlightBackground": null,
"terminal.findMatchHighlightBorder": null,
"terminal.hoverHighlightBackground": null,
"terminalCursor.background": null,
"terminalCursor.foreground": "#{{base05-hex}}",
"terminal.dropBackground": null,
"terminal.tab.activeBorder": null,
"terminalCommandDecoration.defaultBackground": null,
"terminalCommandDecoration.successBackground": null,
"terminalCommandDecoration.errorBackground": null,
"terminalOverviewRuler.cursorForeground": "#ff0000",
"terminalOverviewRuler.findMatchForeground": "#ff0000",
"terminalStickyScroll.background": null,
"terminalStickyScrollHover.background": null,
"debugToolBar.background": "#{{base01-hex}}",
"debugToolBar.border": null,
"editor.stackFrameHighlightBackground": null,
"editor.focusedStackFrameHighlightBackground": null,
"editor.inlineValuesForeground": null,
"editor.inlineValuesBackground": null,
"debugView.exceptionLabelForeground": null,
"debugView.exceptionLabelBackground": null,
"debugView.stateLabelForeground": "#{{base07-hex}}",
"debugView.stateLabelBackground": "#{{base0D-hex}}",
"debugView.valueChangedHighlight": "#{{base0D-hex}}",
@ -333,19 +601,31 @@
"testing.iconQueued": "#{{base0A-hex}}",
"testing.iconUnset": "#{{base04-hex}}",
"testing.iconSkipped": "#{{base0E-hex}}",
"testing.peekBorder": null,
"testing.peekHeaderBackground": "#{{base01-hex}}",
"testing.message.error.decorationForeground": "#{{base05-hex}}",
"testing.message.error.lineBackground": "#{{base08-hex}}20",
"testing.message.info.decorationForeground": "#{{base05-hex}}",
"testing.message.info.lineBackground": "#{{base0D-hex}}20",
"testing.messagePeekBorder": null,
"testing.messagePeekHeaderBackground": null,
"testing.coveredBackground": null,
"testing.coveredBorder": null,
"testing.coveredGutterBackground": null,
"testing.uncoveredBranchBackground": null,
"testing.uncoveredBackground": null,
"testing.uncoveredBorder": null,
"testing.uncoveredGutterBackground": null,
"testing.coverCountBadgeBackground": null,
"testing.coverCountBadgeForeground": null,
"welcomePage.background": "#{{base00-hex}}",
"welcomePage.buttonBackground": "#{{base01-hex}}",
"welcomePage.buttonHoverBackground": "#{{base02-hex}}",
"welcomePage.progress.background": "#{{base03-hex}}",
"welcomePage.progress.foreground": "#{{base0D-hex}}",
"welcomePage.tileBackground": "#{{base01-hex}}",
"welcomePage.tileHoverBackground": "#{{base02-hex}}",
"welcomePage.tileBorder": null,
"walkThrough.embeddedEditorBackground": "#{{base00-hex}}",
"walkthrough.stepTitle.foreground": null,
"gitDecoration.addedResourceForeground": "#{{base0B-hex}}",
"gitDecoration.modifiedResourceForeground": "#{{base0E-hex}}",
"gitDecoration.deletedResourceForeground": "#{{base08-hex}}",
@ -358,26 +638,34 @@
"gitDecoration.submoduleResourceForeground": "#{{base0F-hex}}",
"settings.headerForeground": "#{{base05-hex}}",
"settings.modifiedItemIndicator": "#{{base0D-hex}}",
"settings.modifiedItemForeground": "#{{base0B-hex}}",
"settings.dropdownBackground": "#{{base01-hex}}",
"settings.dropdownForeground": "#{{base05-hex}}",
"settings.dropdownBorder": null,
"settings.dropdownListBorder": null,
"settings.checkboxBackground": "#{{base01-hex}}",
"settings.checkboxForeground": "#{{base05-hex}}",
"settings.checkboxBorder": null,
"settings.rowHoverBackground": "#{{base02-hex}}",
"settings.textInputBackground": "#{{base01-hex}}",
"settings.textInputForeground": "#{{base05-hex}}",
"settings.textInputBorder": null,
"settings.numberInputBackground": "#{{base01-hex}}",
"settings.numberInputForeground": "#{{base05-hex}}",
"settings.numberInputBorder": null,
"settings.focusedRowBackground": "#{{base02-hex}}",
"settings.focusedRowBorder": "#{{base0D-hex}}",
"settings.headerBorder": "#{{base05-hex}}",
"settings.sashBorder": "#{{base05-hex}}",
"settings.settingsHeaderHoverForeground": null,
"breadcrumb.foreground": "#{{base05-hex}}",
"breadcrumb.background": "#{{base01-hex}}",
"breadcrumb.focusForeground": "#{{base06-hex}}",
"breadcrumb.activeSelectionForeground": "#{{base07-hex}}",
"breadcrumbPicker.background": "#{{base01-hex}}",
"editor.snippetTabstopHighlightBackground": "#{{base02-hex}}",
"editor.snippetTabstopHighlightBorder": null,
"editor.snippetFinalTabstopHighlightBackground": "#{{base03-hex}}",
"editor.snippetFinalTabstopHighlightBorder": null,
"symbolIcon.arrayForeground": "#{{base05-hex}}",
"symbolIcon.booleanForeground": "#{{base09-hex}}",
"symbolIcon.classForeground": "#{{base0A-hex}}",
@ -434,16 +722,27 @@
"notebook.editorBackground": "#{{base00-hex}}",
"notebook.cellBorderColor": "#{{base03-hex}}",
"notebook.cellHoverBackground": "#{{base01-hex}}",
"notebook.cellInsertionIndicator": null,
"notebook.cellStatusBarItemHoverBackground": null,
"notebook.cellToolbarSeparator": "#{{base02-hex}}",
"notebook.cellEditorBackground": "#{{base00-hex}}",
"notebook.focusedCellBackground": "#{{base02-hex}}",
"notebook.focusedCellBorder": "#{{base0D-hex}}",
"notebook.focusedEditorBorder": "#{{base0D-hex}}",
"notebook.inactiveFocusedCellBorder": "#{{base03-hex}}",
"notebook.inactiveSelectedCellBorder": null,
"notebook.outputContainerBackgroundColor": null,
"notebook.outputContainerBorderColor": null,
"notebook.selectedCellBackground": "#{{base02-hex}}",
"notebook.selectedCellBorder": null,
"notebook.symbolHighlightBackground": null,
"notebookScrollbarSlider.activeBackground": null,
"notebookScrollbarSlider.background": null,
"notebookScrollbarSlider.hoverBackground": null,
"notebookStatusErrorIcon.foreground": "#{{base08-hex}}",
"notebookStatusRunningIcon.foreground": "#{{base0C-hex}}",
"notebookStatusSuccessIcon.foreground": "#{{base0B-hex}}",
"notebookEditorOverviewRuler.runningCellForeground": null,
"charts.foreground": "#{{base05-hex}}",
"charts.lines": "#{{base05-hex}}",
"charts.red": "#{{base08-hex}}",
@ -452,7 +751,15 @@
"charts.orange": "#{{base09-hex}}",
"charts.green": "#{{base0B-hex}}",
"charts.purple": "#{{base0E-hex}}",
"ports.iconRunningProcessForeground": "#{{base09-hex}}"
"ports.iconRunningProcessForeground": "#{{base09-hex}}",
"commentsView.resolvedIcon": null,
"commentsView.unresolvedIcon": null,
"actionBar.toggledBackground": null,
"simpleFindWidget.sashBorder": null,
"scm.historyItemAdditionsForeground": null,
"scm.historyItemDeletionsForeground": null,
"scm.historyItemStatisticsBorder": null,
"scm.historyItemSelectedStatisticsBorder": null
},
"tokenColors": [
{

36
modules/vscode/update.py Executable file
View file

@ -0,0 +1,36 @@
#! /usr/bin/env nix-shell
#! nix-shell -i python3 -p python3Packages.markdown-it-py python3Packages.requests
# This script parses the reference page and updates our template with any
# added or removed settings.
#
# New settings are null by default. VSCode can handle this gracefully, but
# normally a value should be chosen before committing the update.
#
# This only updates 'colors' and not 'tokenColors' for now.
import json
import os
from markdown_it import MarkdownIt
import requests
documentation = requests.get('https://raw.githubusercontent.com/microsoft/vscode-docs/main/api/references/theme-color.md').text
color_names = [
token.children[0].content
for token in MarkdownIt().parse(documentation)
if token.type == 'inline' and token.children[0].type == 'code_inline'
]
template_path = os.path.join(os.path.dirname(__file__), 'template.mustache')
with open(template_path, 'r') as template_file:
template = json.load(template_file)
template['colors'] = {
color_name: template['colors'].get(color_name)
for color_name in color_names
}
with open(template_path, 'w') as template_file:
json.dump(template, template_file, indent=4)

View file

@ -18,21 +18,21 @@ in
enableLeftBackColors = lib.mkOption {
type = lib.types.bool;
default = false;
description = lib.mdDoc "enables background colors on the left side of the bar";
description = "enables background colors on the left side of the bar";
};
enableCenterBackColors = lib.mkOption {
type = lib.types.bool;
default = false;
description = lib.mdDoc "enables background colors on the center of the bar";
description = "enables background colors on the center of the bar";
};
enableRightBackColors = lib.mkOption {
type = lib.types.bool;
default = false;
description = lib.mdDoc "enables background colors on the right side of the bar";
description = "enables background colors on the right side of the bar";
};
};
config = lib.mkIf config.stylix.targets.waybar.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.waybar.enable) {
programs.waybar.style = ''
@define-color base00 ${base00}; @define-color base01 ${base01}; @define-color base02 ${base02}; @define-color base03 ${base03};
@define-color base04 ${base04}; @define-color base05 ${base05}; @define-color base06 ${base06}; @define-color base07 ${base07};
@ -41,7 +41,7 @@ in
@define-color base0C ${base0C}; @define-color base0D ${base0D}; @define-color base0E ${base0E}; @define-color base0F ${base0F};
* {
font-family: ${sansSerif.name};
font-family: "${sansSerif.name}";
font-size: ${builtins.toString sizes.desktop}pt;
}

View file

@ -3,9 +3,9 @@
let colors = config.lib.stylix.colors.withHashtag;
in {
options.stylix.targets.wezterm.enable =
config.lib.stylix.mkEnableTarget "wezterm" config.programs.wezterm.enable;
config.lib.stylix.mkEnableTarget "wezterm" true;
config = lib.mkIf config.stylix.targets.wezterm.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.wezterm.enable && config.programs.wezterm.enable) {
programs.wezterm.colorSchemes.stylix = with colors; {
ansi = [ base00 base08 base0B base0A base0D base0E base0C base05 ];

9
modules/wpaperd/hm.nix Normal file
View file

@ -0,0 +1,9 @@
{ config, lib, ... }:
{
options.stylix.targets.wpaperd.enable = config.lib.stylix.mkEnableTarget "wpaperd" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.wpaperd.enable) {
programs.wpaperd.settings.any.path = "${config.stylix.image}";
};
}

View file

@ -5,7 +5,7 @@
options.stylix.targets.xfce.enable =
config.lib.stylix.mkEnableTarget "Xfce" false;
config = lib.mkIf config.stylix.targets.xfce.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.xfce.enable) {
xfconf.settings = with config.stylix.fonts; {
xfwm4 = {
"general/title_font" = "${sansSerif.name} ${toString sizes.desktop}";

View file

@ -4,7 +4,7 @@
options.stylix.targets.xresources.enable =
config.lib.stylix.mkEnableTarget "Xresources" true;
config = lib.mkIf config.stylix.targets.xresources.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.xresources.enable) {
xresources.properties = with config.lib.stylix.colors.withHashtag; with config.stylix.fonts; {
"*.faceName" = monospace.name;
"*.faceSize" = sizes.terminal;

122
modules/yazi/hm.nix Normal file
View file

@ -0,0 +1,122 @@
# Based on the official catppuccin themes https://github.com/yazi-rs/themes
{
config,
lib,
...
}: {
options.stylix.targets.yazi = {
enable = config.lib.stylix.mkEnableTarget "Yazi" true;
};
config = lib.mkIf (config.stylix.enable && config.stylix.targets.yazi.enable) {
programs.yazi.theme = with config.lib.stylix.colors.withHashtag; let
mkFg = fg: {inherit fg;};
mkBg = bg: {inherit bg;};
mkBoth = fg: bg: {inherit fg bg;};
mkSame = c: (mkBoth c c);
in {
manager = rec {
# Reusing bat themes, since it's suggested in the stying guide
# https://yazi-rs.github.io/docs/configuration/theme#manager
syntect_theme = config.lib.stylix.colors {
template = ../bat/base16-stylix.mustache;
extension = ".tmTheme";
};
cwd = mkFg base0C;
hovered = (mkBoth base05 base03) // {bold = true;};
preview_hovered = hovered;
find_keyword = (mkFg base0B) // {bold = true;};
find_position = mkFg base05;
marker_selected = mkSame base0B;
marker_copied = mkSame base0A;
marker_cut = mkSame base08;
tab_active = mkBoth base00 base0D;
tab_inactive = mkBoth base05 base01;
border_style = mkFg base04;
};
status = {
separator_style = mkSame base01;
mode_normal = (mkBoth base00 base0D) // {bold = true;};
mode_select = (mkBoth base00 base0B) // {bold = true;};
mode_unset = (mkBoth base00 base0F) // {bold = true;};
progress_label = mkBoth base05 base00;
progress_normal = mkBoth base05 base00;
progress_error = mkBoth base08 base00;
permissions_t = mkFg base0D;
permissions_r = mkFg base0A;
permissions_w = mkFg base08;
permissions_x = mkFg base0B;
permissions_s = mkFg base0C;
};
select = {
border = mkFg base0D;
active = mkFg base0E;
inactive = mkFg base05;
};
input = {
border = mkFg base0D;
title = mkFg base05;
value = mkFg base05;
selected = mkBg base03;
};
completion = {
border = mkFg base0D;
active = mkBoth base0E base03;
inactive = mkFg base05;
};
tasks = {
border = mkFg base0D;
title = mkFg base05;
hovered = mkBoth base05 base03;
};
which = {
mask = mkBg base02;
cand = mkFg base0C;
rest = mkFg base0F;
desc = mkFg base05;
separator_style = mkFg base04;
};
help = {
on = mkFg base0E;
run = mkFg base0C;
desc = mkFg base05;
hovered = mkBoth base05 base03;
footer = mkFg base05;
};
# https://github.com/sxyazi/yazi/blob/main/yazi-config/preset/theme.toml
filetype.rules = let
mkRule = mime: fg: {inherit mime fg;};
in [
(mkRule "image/*" base0C)
(mkRule "video/*" base0A)
(mkRule "audio/*" base0A)
(mkRule "application/zip" base0E)
(mkRule "application/gzip" base0E)
(mkRule "application/x-tar" base0E)
(mkRule "application/x-bzip" base0E)
(mkRule "application/x-bzip2" base0E)
(mkRule "application/x-7z-compressed" base0E)
(mkRule "application/x-rar" base0E)
(mkRule "application/xz" base0E)
(mkRule "application/doc" base0B)
(mkRule "application/pdf" base0B)
(mkRule "application/rtf" base0B)
(mkRule "application/vnd.*" base0B)
((mkRule "inode/directory" base0D) // {bold = true;})
(mkRule "*" base05)
];
};
};
}

View file

@ -1,34 +1,38 @@
{ config, lib, ... }:
with config.lib.stylix.colors;
{
options.stylix.targets.zathura.enable =
config.lib.stylix.mkEnableTarget "Zathura" true;
config = lib.mkIf config.stylix.targets.zathura.enable {
# Taken from here:
# https://github.com/doenerkebap/base16-zathura
programs.zathura.options = {
default-bg = "#${base00}";
default-fg = "#${base01}";
statusbar-fg = "#${base04}";
statusbar-bg = "#${base02}";
inputbar-bg = "#${base00}";
inputbar-fg = "#${base07}";
notification-bg = "#${base00}";
notification-fg = "#${base07}";
notification-error-bg = "#${base00}";
notification-error-fg = "#${base08}";
notification-warning-bg = "#${base00}";
notification-warning-fg = "#${base08}";
highlight-color = "#${base0A}";
highlight-active-color = "#${base0D}";
completion-bg = "#${base01}";
completion-fg = "#${base0D}";
completion-highlight-fg = "#${base07}";
completion-highlight-bg = "#${base0D}";
recolor-lightcolor = "#${base00}";
recolor-darkcolor = "#${base06}";
config = lib.mkIf (config.stylix.enable && config.stylix.targets.zathura.enable) {
programs.zathura.options = let
highlightTransparency = "0.5";
getColorCh = colorName: channel: config.lib.stylix.colors."${colorName}-rgb-${channel}";
rgb = color: ''rgb(${getColorCh color "r"}, ${getColorCh color "g"}, ${getColorCh color "b"})'';
rgba = color: ''rgba(${getColorCh color "r"}, ${getColorCh color "g"}, ${getColorCh color "b"}, ${highlightTransparency})'';
in {
# Taken from here:
# https://github.com/doenerkebap/base16-zathura
default-bg = rgb "base00";
default-fg = rgb "base01";
statusbar-fg = rgb "base04";
statusbar-bg = rgb "base02";
inputbar-bg = rgb "base00";
inputbar-fg = rgb "base07";
notification-bg = rgb "base00";
notification-fg = rgb "base07";
notification-error-bg = rgb "base00";
notification-error-fg = rgb "base08";
notification-warning-bg = rgb "base00";
notification-warning-fg = rgb "base08";
highlight-color = rgba "base0A";
highlight-active-color = rgba "base0D";
completion-bg = rgb "base01";
completion-fg = rgb "base0D";
completion-highlight-fg = rgb "base07";
completion-highlight-bg = rgb "base0D";
recolor-lightcolor = rgb "base00";
recolor-darkcolor = rgb "base06";
};
};
}

View file

@ -2,9 +2,9 @@
{
options.stylix.targets.zellij.enable =
config.lib.stylix.mkEnableTarget "zellij" config.programs.zellij.enable ;
config.lib.stylix.mkEnableTarget "zellij" true;
config = lib.mkIf config.stylix.targets.zellij.enable {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.zellij.enable) {
programs.zellij.settings = {
theme = "stylix";
themes.stylix = with config.lib.stylix.colors.withHashtag; {

View file

@ -1,26 +1,23 @@
{ pkgs, config, lib, ... } @ args:
{ pkgs, lib, ... } @ args:
with lib;
let
cfg = config.stylix.cursor;
fromOs = import ./fromos.nix { inherit lib args; };
in {
{
options.stylix.cursor = {
name = mkOption {
description = mdDoc "The cursor name within the package.";
description = "The cursor name within the package.";
type = types.str;
default = fromOs [ "cursor" "name" ] "Vanilla-DMZ";
default = "Vanilla-DMZ";
};
package = mkOption {
description = mdDoc "Package providing the cursor theme.";
description = "Package providing the cursor theme.";
type = types.package;
default = fromOs [ "cursor" "package" ] pkgs.vanilla-dmz;
default = pkgs.vanilla-dmz;
};
size = mkOption {
description = mdDoc "The cursor size.";
description = "The cursor size.";
type = types.int;
default = fromOs [ "cursor" "size" ] 32;
default = 32;
};
};
}

View file

@ -1,9 +1,8 @@
inputs:
{ palette-generator, base16, homeManagerModule }:
{ options, config, lib, ... }:
{ lib, ... }:
let
hm = config.stylix.homeManagerIntegration;
autoload = import ../autoload.nix { inherit lib; } "darwin";
in {
imports = [
@ -12,37 +11,6 @@ in {
./fonts.nix
(import ./palette.nix { inherit palette-generator base16; })
(import ../templates.nix inputs)
(import ../home-manager-integration.nix homeManagerModule)
] ++ autoload;
options.stylix.homeManagerIntegration = {
followSystem = lib.mkOption {
description = lib.mdDoc ''
When this option is `true`, Home Manager will follow
the system theme by default, rather than requiring a theme to be set.
This will only affect Home Manager configurations which are built
within the nix-darwin configuration.
'';
type = lib.types.bool;
default = true;
};
autoImport = lib.mkOption {
description = lib.mdDoc ''
Whether to enable Stylix automatically for every user.
This only applies to users for which Home Manager is set up within the
nix-darwin configuration.
'';
type = lib.types.bool;
default = options ? home-manager;
defaultText = lib.literalMD ''
`true` when Home Manager is present.
'';
};
};
config = lib.mkIf hm.autoImport {
home-manager.sharedModules = [ homeManagerModule ];
};
}

View file

@ -1,10 +1,10 @@
{ config, ... }:
{ config, lib, ... }:
let
cfg = config.stylix.fonts;
in {
imports = [ ../fonts.nix ];
config.fonts = {
config.fonts = lib.mkIf config.stylix.enable {
fontDir.enable = true;
fonts = cfg.packages;
};

View file

@ -1,10 +1,10 @@
args:
{ config, ... }:
{ config, lib, ... }:
{
imports = [ (import ../palette.nix args) ];
config = {
config = lib.mkIf config.stylix.enable {
environment.etc = config.stylix.generated.fileTree;
};
}

View file

@ -5,17 +5,15 @@ with lib;
let
cfg = config.stylix.fonts;
fromOs = import ./fromos.nix { inherit lib args; };
fontType = types.submodule {
options = {
package = mkOption {
description = mdDoc "Package providing the font.";
description = "Package providing the font.";
type = types.package;
};
name = mkOption {
description = mdDoc "Name of the font within the package.";
description = "Name of the font within the package.";
type = types.str;
};
};
@ -24,36 +22,36 @@ let
in {
options.stylix.fonts = {
serif = mkOption {
description = mdDoc "Serif font.";
description = "Serif font.";
type = fontType;
default = fromOs [ "fonts" "serif" ] {
default = {
package = pkgs.dejavu_fonts;
name = "DejaVu Serif";
};
};
sansSerif = mkOption {
description = mdDoc "Sans-serif font.";
description = "Sans-serif font.";
type = fontType;
default = fromOs [ "fonts" "sansSerif" ] {
default = {
package = pkgs.dejavu_fonts;
name = "DejaVu Sans";
};
};
monospace = mkOption {
description = mdDoc "Monospace font.";
description = "Monospace font.";
type = fontType;
default = fromOs [ "fonts" "monospace" ] {
default = {
package = pkgs.dejavu_fonts;
name = "DejaVu Sans Mono";
};
};
emoji = mkOption {
description = mdDoc "Emoji font.";
description = "Emoji font.";
type = fontType;
default = fromOs [ "fonts" "emoji" ] {
default = {
package = pkgs.noto-fonts-emoji;
name = "Noto Color Emoji";
};
@ -61,42 +59,42 @@ in {
sizes = {
desktop = mkOption {
description = mdDoc ''
description = ''
The font size used in window titles/bars/widgets elements of
the desktop.
'';
type = types.ints.unsigned;
default = fromOs [ "fonts" "sizes" "desktop" ] 10;
default = 10;
};
applications = mkOption {
description = mdDoc ''
description = ''
The font size used by applications.
'';
type = types.ints.unsigned;
default = fromOs [ "fonts" "sizes" "applications" ] 12;
default = 12;
};
terminal = mkOption {
description = mdDoc ''
description = ''
The font size for terminals/text editors.
'';
type = types.ints.unsigned;
default = fromOs [ "fonts" "sizes" "terminal" ] cfg.sizes.applications;
default = cfg.sizes.applications;
};
popups = mkOption {
description = mdDoc ''
description = ''
The font size for notifications/popups and in general overlay
elements of the desktop.
'';
type = types.ints.unsigned;
default = fromOs [ "fonts" "sizes" "popups" ] cfg.sizes.desktop;
default = cfg.sizes.desktop;
};
};
packages = mkOption {
description = mdDoc ''
description = ''
A list of all the font packages that will be installed.
'';
type = types.listOf types.package;
@ -104,7 +102,7 @@ in {
};
};
config = {
config = lib.mkIf config.stylix.enable {
stylix.fonts.packages = [
cfg.monospace.package
cfg.serif.package

View file

@ -1,8 +0,0 @@
{ lib, args }:
path: default:
if ( args ? "osConfig"
&& args.osConfig ? "stylix"
&& args.osConfig.stylix.homeManagerIntegration.followSystem)
then lib.attrByPath path default args.osConfig.stylix
else default

View file

@ -7,7 +7,7 @@ let
in {
imports = [ ../cursor.nix ];
config = mkIf pkgs.stdenv.hostPlatform.isLinux {
config = mkIf (config.stylix.enable && pkgs.stdenv.hostPlatform.isLinux) {
home.pointerCursor = {
name = cfg.name;
package = cfg.package;

View file

@ -1,10 +1,10 @@
{ config, ... }:
{ config, lib, ... }:
let
cfg = config.stylix.fonts;
in {
imports = [ ../fonts.nix ];
config = {
config = lib.mkIf config.stylix.enable {
fonts.fontconfig.enable = true;
home.packages = cfg.packages;
};

View file

@ -1,10 +1,10 @@
args:
{ config, ... }:
{ config, lib, ... }:
{
imports = [ (import ../palette.nix args) ];
config = {
config = lib.mkIf config.stylix.enable {
xdg.configFile = config.stylix.generated.fileTree;
};
}

View file

@ -0,0 +1,79 @@
homeManagerModule:
{ lib, config, options, ... }:
let
copyModules = builtins.map
(
{ path, condition ? lib.const true }:
{ config, osConfig, ... }:
lib.mkIf (condition config)
(lib.setAttrByPath path (lib.mkDefault (lib.getAttrFromPath path osConfig)))
)
[
{ path = [ "stylix" "autoEnable" ]; }
{
path = [ "stylix" "base16Scheme" ];
condition = homeConfig: config.stylix.image == homeConfig.stylix.image;
}
{ path = [ "stylix" "cursor" "name" ]; }
{ path = [ "stylix" "cursor" "package" ]; }
{ path = [ "stylix" "cursor" "size" ]; }
{ path = [ "stylix" "enable" ]; }
{ path = [ "stylix" "fonts" "serif" ]; }
{ path = [ "stylix" "fonts" "sansSerif" ]; }
{ path = [ "stylix" "fonts" "monospace" ]; }
{ path = [ "stylix" "fonts" "emoji" ]; }
{ path = [ "stylix" "fonts" "sizes" "desktop" ]; }
{ path = [ "stylix" "fonts" "sizes" "applications" ]; }
{ path = [ "stylix" "fonts" "sizes" "terminal" ]; }
{ path = [ "stylix" "fonts" "sizes" "popups" ]; }
{ path = [ "stylix" "image" ]; }
{ path = [ "stylix" "imageScalingMode" ]; }
{ path = [ "stylix" "opacity" "desktop" ]; }
{ path = [ "stylix" "opacity" "applications" ]; }
{ path = [ "stylix" "opacity" "terminal" ]; }
{ path = [ "stylix" "opacity" "popups" ]; }
{
path = [ "stylix" "override" ];
condition = homeConfig: config.stylix.base16Scheme == homeConfig.stylix.base16Scheme;
}
{ path = [ "stylix" "polarity" ]; }
];
in {
options.stylix.homeManagerIntegration = {
followSystem = lib.mkOption {
description = ''
When this option is `true`, Home Manager configurations will follow
the NixOS configuration by default, rather than using the standard
default settings.
This only applies to Home Manager configurations managed by
[`stylix.homeManagerIntegration.autoImport`](#stylixhomemanagerintegrationautoimport).
'';
type = lib.types.bool;
default = true;
example = false;
};
autoImport = lib.mkOption {
description = ''
Whether to import Stylix automatically for every Home Manager user.
This only works if you are using `home-manager.users.«name»` within
your NixOS configuration, rather than running Home Manager independently.
'';
type = lib.types.bool;
default = true;
example = false;
};
};
config =
lib.optionalAttrs (options ? home-manager)
(lib.mkIf config.stylix.homeManagerIntegration.autoImport {
home-manager.sharedModules =
[ homeManagerModule ] ++
(lib.optionals config.stylix.homeManagerIntegration.followSystem copyModules);
});
}

View file

@ -1,10 +1,10 @@
{ config, ... }:
{ config, lib, ... }:
let
cfg = config.stylix.cursor;
in {
imports = [ ../cursor.nix ];
config = {
config = lib.mkIf config.stylix.enable {
environment.variables.XCURSOR_SIZE = toString cfg.size;
};
}

View file

@ -1,9 +1,8 @@
inputs:
{ palette-generator, base16, homeManagerModule }:
{ options, config, lib, ... }:
{ lib, ... }:
let
hm = config.stylix.homeManagerIntegration;
autoload = import ../autoload.nix { inherit lib; } "nixos";
in {
imports = [
@ -14,37 +13,6 @@ in {
./fonts.nix
(import ./palette.nix { inherit palette-generator base16; })
(import ../templates.nix inputs)
(import ../home-manager-integration.nix homeManagerModule)
] ++ autoload;
options.stylix.homeManagerIntegration = {
followSystem = lib.mkOption {
description = lib.mdDoc ''
When this option is `true`, Home Manager will follow
the system theme by default, rather than requiring a theme to be set.
This will only affect Home Manager configurations which are built
within the NixOS configuration.
'';
type = lib.types.bool;
default = true;
};
autoImport = lib.mkOption {
description = lib.mdDoc ''
Whether to enable Stylix automatically for every user.
This only applies to users for which Home Manager is set up within the
NixOS configuration.
'';
type = lib.types.bool;
default = options ? home-manager;
defaultText = lib.literalMD ''
`true` when Home Manager is present.
'';
};
};
config = lib.optionalAttrs (options ? home-manager) (lib.mkIf hm.autoImport {
home-manager.sharedModules = [ homeManagerModule ];
});
}

View file

@ -1,10 +1,10 @@
{ config, ... }:
{ config, lib, ... }:
let
cfg = config.stylix.fonts;
in {
imports = [ ../fonts.nix ];
config.fonts = {
config.fonts = lib.mkIf config.stylix.enable {
packages = cfg.packages;
fontconfig.defaultFonts = {

View file

@ -1,10 +1,10 @@
args:
{ config, ... }:
{ config, lib, ... }:
{
imports = [ (import ../palette.nix args) ];
config = {
config = lib.mkIf config.stylix.enable {
environment.etc = config.stylix.generated.fileTree;
};
}

View file

@ -1,31 +1,28 @@
{ pkgs, config, lib, ... } @ args:
{ lib, ... } @ args:
with lib;
let
cfg = config.stylix.opacity;
fromOs = import ./fromos.nix { inherit lib args; };
in {
{
options.stylix.opacity = {
desktop = mkOption {
description = mdDoc "The opacity of the windows of bars/widgets, the amount of applications supported is currently limited";
description = "The opacity of the windows of bars/widgets, the amount of applications supported is currently limited";
type = types.float;
default = fromOs [ "opacity" "desktop" ] 1.0;
default = 1.0;
};
applications = mkOption {
description = mdDoc "The opacity of the windows of applications, the amount of applications supported is currently limited";
description = "The opacity of the windows of applications, the amount of applications supported is currently limited";
type = types.float;
default = fromOs [ "opacity" "applications" ] 1.0;
default = 1.0;
};
terminal = mkOption {
description = mdDoc "The opacity of the windows of terminals, this works across all terminals supported by stylix";
description = "The opacity of the windows of terminals, this works across all terminals supported by stylix";
type = types.float;
default = fromOs [ "opacity" "terminal" ] 1.0;
default = 1.0;
};
popups = mkOption {
description = mdDoc "The opacity of the windows of notifications/popups, the amount of applications supported is currently limited";
description = "The opacity of the windows of notifications/popups, the amount of applications supported is currently limited";
type = types.float;
default = fromOs [ "opacity" "popups" ] 1.0;
default = 1.0;
};
};
}

View file

@ -4,13 +4,14 @@
with lib;
let
fromOs = import ./fromos.nix { inherit lib args; };
cfg = config.stylix;
paletteJSON = let
generatedJSON = pkgs.runCommand "palette.json" { } ''
${palette-generator}/bin/palette-generator ${cfg.polarity} ${cfg.image} $out
${palette-generator}/bin/palette-generator \
"${cfg.polarity}" \
${lib.escapeShellArg "${cfg.image}"} \
"$out"
'';
palette = importJSON generatedJSON;
scheme = base16.mkSchemeAttrs palette;
@ -21,12 +22,6 @@ let
in json;
generatedScheme = importJSON paletteJSON;
override =
(if cfg.base16Scheme == fromOs [ "base16Scheme" ] {}
then fromOs [ "override" ] {}
else {})
// cfg.override;
in {
# TODO link to doc on how to do instead
imports = [
@ -51,8 +46,8 @@ in {
options.stylix = {
polarity = mkOption {
type = types.enum [ "either" "light" "dark" ];
default = fromOs [ "polarity" ] "either";
description = mdDoc ''
default = "either";
description = ''
Use this option to force a light or dark theme.
By default we will select whichever is ranked better by the genetic
@ -63,13 +58,23 @@ in {
image = mkOption {
type = types.coercedTo types.package toString types.path;
description = mdDoc ''
description = ''
Wallpaper image.
This is set as the background of your desktop environment, if possible,
and used to generate a colour scheme if you don't set one manually.
'';
default = fromOs [ "image" ] null;
};
imageScalingMode = mkOption {
type = types.enum [ "stretch" "fill" "fit" "center" "tile" ];
default = "fill";
description = ''
Wallpaper scaling mode;
This is the scaling mode your wallpaper image will use assuming it
doesnt fix your monitor perfectly
'';
};
generated = {
@ -98,16 +103,13 @@ in {
};
base16Scheme = mkOption {
description = mdDoc ''
description = ''
A scheme following the base16 standard.
This can be a path to a file, a string of YAML, or an attribute set.
'';
type = with types; oneOf [ path lines attrs ];
default =
if cfg.image != fromOs [ "image" ] null
then generatedScheme
else fromOs [ "base16Scheme" ] generatedScheme;
default = generatedScheme;
defaultText = literalMD ''
The colors used in the theming.
@ -117,7 +119,7 @@ in {
};
override = mkOption {
description = mdDoc ''
description = ''
An override that will be applied to stylix.base16Scheme when generating
lib.stylix.colors.
@ -132,7 +134,7 @@ in {
config = {
# This attrset can be used like a function too, see
# https://github.com/SenchoPens/base16.nix/blob/b390e87cd404e65ab4d786666351f1292e89162a/README.md#theme-step-22
lib.stylix.colors = (base16.mkSchemeAttrs cfg.base16Scheme).override override;
lib.stylix.colors = (base16.mkSchemeAttrs cfg.base16Scheme).override cfg.override;
lib.stylix.scheme = base16.mkSchemeAttrs cfg.base16Scheme;
stylix.generated.fileTree = {

View file

@ -2,39 +2,49 @@
with lib;
let
fromOs = import ./fromos.nix { inherit lib args; };
in {
options.stylix.autoEnable = mkOption {
description = mdDoc "Whether to automatically enable styling for installed targets.";
type = types.bool;
default = fromOs [ "autoEnable" ] true;
{
options.stylix = {
enable = mkOption {
description = ''
Whether to enable Stylix.
When this is `false`, all theming is disabled and all other options
are ignored.
'';
type = types.bool;
default = false;
example = true;
};
autoEnable = mkOption {
description = ''
Whether to enable targets by default.
When this is `false`, all targets are disabled unless explicitly enabled.
When this is `true`, most targets are enabled by default. A small number
remain off by default, because they require further manual setup, or
they are only applicable in specific circumstances which cannot be
detected automatically.
'';
type = types.bool;
default = true;
example = false;
};
};
config.lib.stylix.mkEnableTarget =
config.lib.stylix.mkEnableTarget = let
cfg = config.stylix;
in
humanName:
# If the module only touches options under its target (programs.target.*)
# then this can simply be `true`, as those options are already gated by the
# upstream enable option.
#
# Otherwise, use `config` to check whether the target is enabled.
#
# If some manual setup is required, or the module leads to the target
# being installed if it wasn't already, set this to `false`.
autoEnable:
mkOption {
description = mdDoc "Whether to style ${humanName}.";
type = types.bool;
# We can't substitute the target name into this description because some
# don't make sense: "if the desktop background using Feh is installed"
defaultText = literalMD ''
`true` if `stylix.autoEnable == true` and the target is installed,
otherwise `false`.
'';
default = config.stylix.autoEnable && autoEnable;
};
mkEnableOption
"theming for ${humanName}"
// {
default = cfg.enable && cfg.autoEnable && autoEnable;
example = !autoEnable;
}
// optionalAttrs autoEnable {
defaultText = literalMD "same as [`stylix.autoEnable`](#stylixautoenable)";
};
}

Some files were not shown because too many files have changed in this diff Show more