|
|
|
@ -2,13 +2,13 @@ defmodule BlockScoutWeb.AddressDecompiledContractView do |
|
|
|
|
use BlockScoutWeb, :view |
|
|
|
|
|
|
|
|
|
@colors %{ |
|
|
|
|
"\033[95m" => "235, 97, 247", |
|
|
|
|
"\033[91m" => "236, 89, 58", |
|
|
|
|
"\033[38;5;8m" => "111, 110, 111", |
|
|
|
|
"\033[32m" => "107, 194, 76", |
|
|
|
|
"\033[93m" => "239, 236, 84", |
|
|
|
|
"\033[92m" => "119, 232, 81", |
|
|
|
|
"\033[94m" => "184, 90, 190" |
|
|
|
|
"\e[95m" => "235, 97, 247", |
|
|
|
|
"\e[91m" => "236, 89, 58", |
|
|
|
|
"\e[38;5;8m" => "111, 110, 111", |
|
|
|
|
"\e[32m" => "107, 194, 76", |
|
|
|
|
"\e[93m" => "239, 236, 84", |
|
|
|
|
"\e[92m" => "119, 232, 81", |
|
|
|
|
"\e[94m" => "184, 90, 190" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
def highlight_decompiled_code(code) do |
|
|
|
@ -16,8 +16,8 @@ defmodule BlockScoutWeb.AddressDecompiledContractView do |
|
|
|
|
|> Enum.reduce(code, fn {symbol, rgb}, acc -> |
|
|
|
|
String.replace(acc, symbol, "<span style=\"color:rgb(#{rgb})\">") |
|
|
|
|
end) |
|
|
|
|
|> String.replace("\033[1m", "<span style=\"font-weight:bold\">") |
|
|
|
|
|> String.replace("\e[1m", "<span style=\"font-weight:bold\">") |
|
|
|
|
|> String.replace("»", "»") |
|
|
|
|
|> String.replace("\033[0m", "</span>") |
|
|
|
|
|> String.replace("\e[0m", "</span>") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|