diff options
| author | Andrew Davis <abdavis7@gmail.com> | 2025-06-11 00:34:33 -0600 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-06-11 02:40:36 -0700 |
| commit | 07080a0431d86d64efed6fa557c2a02cb9041e93 (patch) | |
| tree | e0b4703dc1e9099219ea7386858c470006724dcb | |
| parent | aa47223c196a7723199e184e20f5fe42539eaf73 (diff) | |
| download | niri-07080a0431d86d64efed6fa557c2a02cb9041e93.tar.gz niri-07080a0431d86d64efed6fa557c2a02cb9041e93.tar.bz2 niri-07080a0431d86d64efed6fa557c2a02cb9041e93.zip | |
Clamp colors to valid values when parsing config
The oklch color space often creates weird values when parsed by csscolorparser.
clamping the output to values between 0 and 1 should fix inconsistent color handling
on borders.
| -rw-r--r-- | niri-config/src/lib.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index 67a621de..2d42e9f2 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -2677,7 +2677,10 @@ impl FromStr for Color { type Err = miette::Error; fn from_str(s: &str) -> Result<Self, Self::Err> { - let color = csscolorparser::parse(s).into_diagnostic()?.to_array(); + let color = csscolorparser::parse(s) + .into_diagnostic()? + .clamp() + .to_array(); Ok(Self::from_array_unpremul(color)) } } |
