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