mirror of
https://github.com/alacritty/alacritty.git
synced 2026-12-03 18:10:13 +03:00
Apply clamp for opacity
Previously opacity was not clamping during reading it from the config or via IPC.
This commit is contained in:
1 parent
4ad5ba3630
commit
80d87ed5db
1 file changed
+10
-1
@@ -583,7 +583,7 @@ impl PartialEq for LazyRegexVariant {
|
||||
impl Eq for LazyRegexVariant {}
|
||||
|
||||
/// Wrapper around f32 that represents a percentage value between 0.0 and 1.0.
|
||||
#[derive(SerdeReplace, Serialize, Deserialize, Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(SerdeReplace, Serialize, Clone, Copy, Debug, PartialEq)]
|
||||
pub struct Percentage(f32);
|
||||
|
||||
impl Default for Percentage {
|
||||
@@ -602,6 +602,15 @@ impl Percentage {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for Percentage {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
Ok(Percentage::new(f32::deserialize(deserializer)?))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
|
||||
#[serde(untagged, deny_unknown_fields)]
|
||||
pub enum Program {
|
||||
|
||||
Reference in new issue
Block a user