11.stylix/FAQ.md
SnIcK dd7fc590c3
Add FAQ.md (#52)
Co-authored-by: Daniel Thwaites <danthwaites30@btinternet.com>
2023-03-02 09:49:44 +00:00

24 lines
782 B
Markdown

# FAQ
## NixOS Stylix Tricks
### Adjusting the brightness and contrast of a background image
If you want to use a background image for your desktop but find it too bright or distracting, you can use the `imagemagick` package to dim the image, or adjust its brightness and contrast to suit your preference.
Here's an example Nix expression that takes an input image, applies a brightness/contrast adjustment to it, and saves the result as a new image file:
```nix
{ pkgs, ... }:
let
inputImage = ./path/to/image.jpg;
brightness = -30;
contrast = 0;
fillColor = "black"
in
{
stylix.image = pkgs.runCommand "dimmed-background.png" { } ''
${pkgs.imagemagick}/bin/convert "${inputImage}" -brightness-contrast ${brightness},${contrast} -fill ${fillColor} $out
'';
}