rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: Kokos on February 06, 2020, 07:55:52 AM

Title: Custom highlight colors in log window or better adjusting to system colors
Post by: Kokos on February 06, 2020, 07:55:52 AM
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.
Title: Re: Custom highlight colors in log window or better adjusting to system colors
Post by: rejetto on February 06, 2020, 11:25:00 AM
welcome Kokos,
i'll look into this problem when i'm back home.
Title: Re: Custom highlight colors in log window or better adjusting to system colors
Post by: Kokos on February 06, 2020, 11:46:58 AM
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:
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:
Extended detailed solution

Above list is the minimal set of settings of log window colors. The extended list would be as follows:
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:
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 (https://github.com/NeekSandhu/codemirror-textmate).

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>
Title: Re: Custom highlight colors in log window or better adjusting to system colors
Post by: rejetto on February 06, 2020, 10:30:32 PM
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.
Title: Re: Custom highlight colors in log window or better adjusting to system colors
Post by: rejetto on February 16, 2020, 10:03:27 PM
you may be interested in testing the latest beta version, including this fix
http://rejetto.com/forum/index.php?topic=13060.0