rejetto forum

Custom highlight colors in log window or better adjusting to system colors

Kokos · 5 · 2526

0 Members and 1 Guest are viewing this topic.

Offline Kokos

  • Occasional poster
  • *
    • Posts: 2
    • View Profile
I have dark theme in my system. Default colors in my case are white text on black background. When I run HFS with this theme, I can't see black text on black background of log window. Is there any method to customize highlight colors or to force the HFS to respect system colors?

Please, check the string value of SelectedStyle under registry key HKEY_CURRENT_USER\Control Panel\Appearance\New Schemes. Then check the subkey indicated by previously checked string value. In this subkey you have deeper subkey Sizes and it's subkeys 0, 1, 2 and so on. These keys group a color styles by the sizes of the GUI elements. You can ignore these sizes. Check values under whichever of these keys. Value of Color #5 is for background, value of Color #8 is for text color on this background.
« Last Edit: February 06, 2020, 11:42:38 AM by Kokos »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile

Offline Kokos

  • Occasional poster
  • *
    • Posts: 2
    • View Profile
Thanks for your interest and for the answer!

Source of the problem

The main problem is that the HFS takes into account the background color of system's GUI elements but ignores the text color on this background. HFS should ignore both or respect both. Taking into account only one of these system settings lead to mentioned bug.

General solution

The best approach would be:
  • default to respecting both or none of mentioned system settings and...
  • allowing a user to customize highlight colors if they think the default approach (mentioned above) is not sufficient.
Detailed solution

When you right-click the log window, the context menu with some options is unrolled. One of these option is Font.... Why not to provide an additional option like Colors... or a submenu Colors with following entries:
  • Default background...
  • Selection background...
  • Default text...
  • Date and Time text...
  • IP or host name text...
  • Dumped headers text...
Extended detailed solution

Above list is the minimal set of settings of log window colors. The extended list would be as follows:
  • Default - background...
  • Default - text...
  • Default - selection background...
  • Default - selection text...
  • Date and Time - background...
  • Date and Time - text...
  • Date and Time - selection background...
  • Date and Time - selection text...
  • IP or host name - background...
  • IP or host name - text...
  • IP or host name - selection background...
  • IP or host name - selection text...
  • Dumped headers - background...
  • Dumped headers - text...
  • Dumped headers - selection background...
  • Dumped headers - selection text...
Outside of the problem
The following issues are only partially related to the mentioned problem.

Ogrammar files
It would be fine to release "HFS log" grammar files for syntax highlighting in some of the most popular text editiors and IDEs like:
  • compatible with TextMate language grammars: Sublime Text, TextMate, Atom, and not sure about CudaText and LimeText
  • based on Scintilla editing component: Notepad++, Geany, Notepad2, Code::Blocks, Eric Python IDE, CodeLite, Leo (Leonine Editor with Outlines), Komodo Edit, Komodo IDE
  • based on CodeMirror editing component: Brackets, Light Table, Codeanywhere
  • vim and other based on Vi
  • Emacs and other based on Emacs
  • others popular: Visual Studio Code, EmEditor, Kate, gedit, PSPad, SlickEdit, Textpad, UltraEdit, Bluefish etc.
It would be sufficient to release only 5 grammar files for most widely used text editing components: TextMate, Scintilla, CodeMirror, Vi, Emacs.
EDIT: It would be sufficient to release only 4 grammar files because of Textmate grammars support for CodeMirror.

export log to HTML
When particular text editor don't support HFS log syntax, then for some people it would be great to be able to export log to HTML file maintaining syntax highlighting.

Sample log in HTML format:
Code: [Select]
<html>
<head>
<meta charset="utf-8" />
<title>HFS log from 2020-02-06 16:44:10 to 2020-02-06 16:44:11</title>
<style>
body {
background-color: #000;
color: #fff;
font-family: Fira Code Medium, monospace;
font-weight: 500;
}
body > * {
margin-bottom: 1em;
}
.connections {

}
.request {

}
.request-headers {
margin-left: 2em;
color: #00f;
white-space: pre-line;
}
.request-headers:first-line {
line-height: 0;
}
.time {
display: inline-block;
color: #f00;
}
.address {
color: #080;
white-space: pre;
}
</style>
</head>
<body>
<div class="connections">
<span class="time">2020-02-06 16:44:10</span> <span class="address">12.34.56.78:1001</span> Connected
</div>

<div class="request">
<span class="time">2020-02-06 16:44:10</span> <span class="address">12.34.56.78:1001</span> Requested GET /someDirectory/someFile.html
<span class="time">2020-02-06 16:44:10</span> <span class="address">12.34.56.78:1001</span> Request dump
<div class="request-headers">
GET /someDirectory/someFile.html HTTP/1.1
Host: 12.34.56.78
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT ...) ...
Accept-Encoding: gzip, deflate, sdch
Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: HFS_SID_=0.502198243869051
If-Modified-Since: Thu, 06 Feb 2020 16:43:40 GMT
</div>
<span class="time">2020-02-06 16:44:10</span> <span class="address">12.34.56.78:1001</span> Not modified, use cache
</div>

<div class="connections">
<span class="time">2020-02-06 16:44:10</span> <span class="address">12.34.56.78:1001</span> Disconnected by server - 576 bytes sent
<span class="time">2020-02-06 16:44:10</span> <span class="address">12.34.56.78:1002</span> Connected
<span class="time">2020-02-06 16:44:10</span> <span class="address">12.34.56.78:1003</span> Connected
</div>

<div class="request">
<span class="time">2020-02-06 16:44:10</span> <span class="address">12.34.56.78:1002</span> Requested GET /styles/main_style.css
<span class="time">2020-02-06 16:44:10</span> <span class="address">12.34.56.78:1002</span> Request dump
<div class="request-headers">
GET /styles/main_style.css HTTP/1.1
Host: 12.34.56.78
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/css,*/*;q=0.1
If-Modified-Since: Thu, 06 Feb 2020 16:43:56 GMT
User-Agent: Mozilla/5.0 (Windows NT ...) ...
Referer: http://12.34.56.78/someDirectory/someFile.html
Accept-Encoding: gzip, deflate, sdch
Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: HFS_SID_=0.502198243869051
</div>
<span class="time">2020-02-06 16:44:10</span> <span class="address">12.34.56.78:1002</span> Served 1.8 K
</div>

<div class="connections">
<span class="time">2020-02-06 16:44:10</span> <span class="address">12.34.56.78:1004</span> Connected
</div>

<div class="request">
<span class="time">2020-02-06 16:44:11</span> <span class="address">12.34.56.78:1003</span> Requested GET /styles/non_existent_file.css
<span class="time">2020-02-06 16:44:11</span> <span class="address">12.34.56.78:1003</span> Request dump
<div class="request-headers">
GET /styles/non_existent_file.css HTTP/1.1
Host: 12.34.56.78
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/css,*/*;q=0.1
User-Agent: Mozilla/5.0 (Windows NT ...) ...
Referer: http://12.34.56.78/someDirectory/someFile.html
Accept-Encoding: gzip, deflate, sdch
Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: HFS_SID_=0.502198243869051
</div>
<span class="time">2020-02-06 16:44:11</span> <span class="address">12.34.56.78:1003</span> Not served: 404 - Not found
</div>
</body>
</html>
« Last Edit: February 06, 2020, 07:50:30 PM by Kokos »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
i've found the point where i set 'black' as  text color for the log, and changed it to the system value (called 'window text').

About the logs, you don't need to make a dedicated highlighter, as you can configure the export format to be the same of existing standard (like apache's) and use existing highlighters.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile