Skip to content

Commit

Permalink
+ MASSIVE improvement of minitest's pride plugin output: Frequencies …
Browse files Browse the repository at this point in the history
…doubled! Sine waves shifted!! Comments improved!!! Colors rotated!!!! (havenwood)

[git-p4: depot-paths = "//src/minitest/dev/": change = 14071]
  • Loading branch information
zenspider committed Mar 13, 2024
1 parent 1ead76c commit 9d2fc6c
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions lib/minitest/pride_plugin.rb
Expand Up @@ -113,19 +113,16 @@ def initialize io # :nodoc:
#
# plot (3*sin(x)+3), (3*sin(x+2*pi/3)+3), (3*sin(x+4*pi/3)+3)

# 6 has wide pretty gradients. 3 == lolcat, about half the width
@colors = (0...(6 * 7)).map { |n|
n *= 1.0 / 6
@colors = (6 * 7).times.map { |n|
n *= 1.0 / 3
r = (3 * Math.sin(n ) + 3).to_i
g = (3 * Math.sin(n + 2 * PI_3) + 3).to_i
b = (3 * Math.sin(n + 4 * PI_3) + 3).to_i

# Then we take rgb and encode them in a single number using base 6.
# For some mysterious reason, we add 16... to clear the bottom 4 bits?
# Yes... they're ugly.
g = (3 * Math.sin(n + 4 * PI_3) + 3).to_i
b = (3 * Math.sin(n + 2 * PI_3) + 3).to_i

# Then we take rgb and encode them in a single number using
# base 6, shifted by 16 for the base 16 ansi colors.
36 * r + 6 * g + b + 16
}
}.rotate(4) # puts "red" first

super
end
Expand Down

0 comments on commit 9d2fc6c

Please sign in to comment.