diff --git a/src/tools/monitor.rb b/src/tools/monitor.rb index ae33182..bd794bd 100755 --- a/src/tools/monitor.rb +++ b/src/tools/monitor.rb @@ -2,16 +2,6 @@ require 'websocket-eventmachine-client' require 'pp' -def rgb2ansi(r, g, b) - if r==g && g==b - return 16 if r<8 - return 231 if r>248 - return (((r - 8) / 247.0) * 24).round + 232 - end - - return 16 + 36*(r/51.0).round + 6*(g/51.0).round + (b/51.0).round -end - IP = ARGV[0] EFFECT = ARGV[1] uri = "ws://#{IP}:80/ws" @@ -41,8 +31,7 @@ EM.run do str += "|" (0...width).each do |x| r, g, b = *data.shift(3) - color_code = rgb2ansi(r, g, b) - str += "\033[48;5;#{color_code}m " + str += "\033[38;2;#{r};#{g};#{b}m●" end str += "\033[0m|\n" end