prefer the word lightness
over luminance
This commit is contained in:
parent
2698e8257b
commit
01c1cf3bb3
@ -30,10 +30,10 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
|
||||
.into());
|
||||
}
|
||||
|
||||
let luminance = match channels.pop() {
|
||||
let lightness = match channels.pop() {
|
||||
Some(Value::Dimension(n, _)) => n / Number::from(100),
|
||||
Some(v) => return Err(format!("$luminance: {} is not a number", v).into()),
|
||||
None => return Err("Missing element $luminance.".into()),
|
||||
Some(v) => return Err(format!("$lightness: {} is not a number", v).into()),
|
||||
None => return Err("Missing element $lightness.".into()),
|
||||
};
|
||||
|
||||
let saturation = match channels.pop() {
|
||||
@ -51,7 +51,7 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
|
||||
Ok(Value::Color(Color::from_hsla(
|
||||
hue,
|
||||
saturation,
|
||||
luminance,
|
||||
lightness,
|
||||
Number::one(),
|
||||
)))
|
||||
} else {
|
||||
@ -63,9 +63,9 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
|
||||
Value::Dimension(n, _) => n / Number::from(100),
|
||||
v => return Err(format!("$saturation: {} is not a number.", v).into()),
|
||||
};
|
||||
let luminance = match arg!(args, 2, "luminance") {
|
||||
let lightness = match arg!(args, 2, "lightness") {
|
||||
Value::Dimension(n, _) => n / Number::from(100),
|
||||
v => return Err(format!("$luminance: {} is not a number.", v).into()),
|
||||
v => return Err(format!("$lightness: {} is not a number.", v).into()),
|
||||
};
|
||||
let alpha = match arg!(
|
||||
args,
|
||||
@ -82,7 +82,7 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
|
||||
v => return Err(format!("$alpha: {} is not a number.", v).into()),
|
||||
};
|
||||
Ok(Value::Color(Color::from_hsla(
|
||||
hue, saturation, luminance, alpha,
|
||||
hue, saturation, lightness, alpha,
|
||||
)))
|
||||
}
|
||||
}),
|
||||
@ -108,10 +108,10 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
|
||||
.into());
|
||||
}
|
||||
|
||||
let luminance = match channels.pop() {
|
||||
let lightness = match channels.pop() {
|
||||
Some(Value::Dimension(n, _)) => n / Number::from(100),
|
||||
Some(v) => return Err(format!("$luminance: {} is not a number", v).into()),
|
||||
None => return Err("Missing element $luminance.".into()),
|
||||
Some(v) => return Err(format!("$lightness: {} is not a number", v).into()),
|
||||
None => return Err("Missing element $lightness.".into()),
|
||||
};
|
||||
|
||||
let saturation = match channels.pop() {
|
||||
@ -129,7 +129,7 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
|
||||
Ok(Value::Color(Color::from_hsla(
|
||||
hue,
|
||||
saturation,
|
||||
luminance,
|
||||
lightness,
|
||||
Number::one(),
|
||||
)))
|
||||
} else {
|
||||
@ -141,9 +141,9 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
|
||||
Value::Dimension(n, _) => n / Number::from(100),
|
||||
v => return Err(format!("$saturation: {} is not a number.", v).into()),
|
||||
};
|
||||
let luminance = match arg!(args, 2, "luminance") {
|
||||
let lightness = match arg!(args, 2, "lightness") {
|
||||
Value::Dimension(n, _) => n / Number::from(100),
|
||||
v => return Err(format!("$luminance: {} is not a number.", v).into()),
|
||||
v => return Err(format!("$lightness: {} is not a number.", v).into()),
|
||||
};
|
||||
let alpha = match arg!(
|
||||
args,
|
||||
@ -160,7 +160,7 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
|
||||
v => return Err(format!("$alpha: {} is not a number.", v).into()),
|
||||
};
|
||||
Ok(Value::Color(Color::from_hsla(
|
||||
hue, saturation, luminance, alpha,
|
||||
hue, saturation, lightness, alpha,
|
||||
)))
|
||||
}
|
||||
}),
|
||||
|
@ -159,7 +159,7 @@ test!(
|
||||
);
|
||||
test!(
|
||||
hsl_named,
|
||||
"a {\n color: hsl($hue: 193, $saturation: 67%, $luminance: 99);\n}\n",
|
||||
"a {\n color: hsl($hue: 193, $saturation: 67%, $lightness: 99);\n}\n",
|
||||
"a {\n color: #fbfdfe;\n}\n"
|
||||
);
|
||||
test!(
|
||||
@ -184,7 +184,7 @@ test!(
|
||||
);
|
||||
test!(
|
||||
hsla_named,
|
||||
"a {\n color: hsla($hue: 193, $saturation: 67%, $luminance: 99, $alpha: .6);\n}\n",
|
||||
"a {\n color: hsla($hue: 193, $saturation: 67%, $lightness: 99, $alpha: .6);\n}\n",
|
||||
"a {\n color: rgba(251, 253, 254, 0.6);\n}\n"
|
||||
);
|
||||
test!(
|
||||
|
Loading…
x
Reference in New Issue
Block a user