mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-06-20 09:47:57 +02:00
Clean up case statement in trucolor.cr
This commit is contained in:
parent
5517a31687
commit
8995a60167
@ -34,24 +34,15 @@ module Trucolor
|
|||||||
f = n - 43 * h
|
f = n - 43 * h
|
||||||
t = f * 255 / 43
|
t = f * 255 / 43
|
||||||
q = 255 - t
|
q = 255 - t
|
||||||
|
|
||||||
case h
|
case h
|
||||||
when 0
|
when 0; return {255, t, 0}
|
||||||
return {255, t, 0}
|
when 1; return {q, 255, 0}
|
||||||
when 1
|
when 2; return {0, 255, t}
|
||||||
return {q, 255, 0}
|
when 3; return {0, q, 255}
|
||||||
when 2
|
when 4; return {t, 0, 255}
|
||||||
return {0, 255, t}
|
when 5; return {255, 0, q}
|
||||||
when 3
|
|
||||||
return {0, q, 255}
|
|
||||||
when 4
|
|
||||||
return {t, 0, 255}
|
|
||||||
when 5
|
|
||||||
return {255, 0, q}
|
|
||||||
else
|
|
||||||
return {0, 0, 0}
|
|
||||||
end
|
end
|
||||||
|
return {0, 0, 0}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Tests the format method by printing a rainbow of colors
|
# Tests the format method by printing a rainbow of colors
|
||||||
|
Loading…
x
Reference in New Issue
Block a user