Optimized bug solution

This commit is contained in:
Kevin Veen-Birkenbach 2023-06-16 18:42:22 +02:00
parent 6fb99205c8
commit bac40d54c9

View File

@ -42,18 +42,13 @@ calculate_color() {
local current_g=$(awk "BEGIN { g = ${start_g} + (${end_g} - ${start_g}) * ${transition_ratio}; printf(\"%.0f\", g) }") local current_g=$(awk "BEGIN { g = ${start_g} + (${end_g} - ${start_g}) * ${transition_ratio}; printf(\"%.0f\", g) }")
local current_b=$(awk "BEGIN { b = ${start_b} + (${end_b} - ${start_b}) * ${transition_ratio}; printf(\"%.0f\", b) }") local current_b=$(awk "BEGIN { b = ${start_b} + (${end_b} - ${start_b}) * ${transition_ratio}; printf(\"%.0f\", b) }")
# Set value to ff if value is 100 local calculated_color=$(printf "%02x%02x%02x" "$current_r" "$current_g" "$current_b")
if [ "$current_r" -eq 100 ]; then
current_r="ff" if [ "$calculated_color" = "ffff100" ]; then
fi calculated_color="ffffff"
if [ "$current_g" -eq 100 ]; then
current_g="ff"
fi
if [ "$current_b" -eq 100 ]; then
current_b="ff"
fi fi
printf "%02x%02x%02x" "$current_r" "$current_g" "$current_b" echo "$calculated_color"
} }
# Get the current time in HH:MM format # Get the current time in HH:MM format