Correct the implementation of bulmaColorBrightness

Instead of using all channels of the colour to approximate brightness,
this function was sublty ignoring the blue channel and over-stating
other channels.
This commit is contained in:
Ben Anderson 2024-06-11 15:25:27 +12:00
parent db6f2cd0e3
commit 4236077572
No known key found for this signature in database

View File

@ -184,10 +184,10 @@
@function bulmaColorBrightness($n) { @function bulmaColorBrightness($n) {
$color-brightness: round( $color-brightness: round(
(red($n) * 299) + (green($n) * 587) + (blue($n) * 114) / 1000 ((red($n) * 299) + (green($n) * 587) + (blue($n) * 114)) / 1000
); );
$light-color: round( $light-color: round(
(red(#ffffff) * 299) + (green(#ffffff) * 587) + (blue(#ffffff) * 114) / 1000 ((red(#ffffff) * 299) + (green(#ffffff) * 587) + (blue(#ffffff) * 114)) / 1000
); );
@if abs($color-brightness) < math.div($light-color, 2) { @if abs($color-brightness) < math.div($light-color, 2) {