Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0516a61
Merge pull request #239 from zarunbal/Development
Hirogen Jul 20, 2022
cb39ad4
added credits
Hirogen Jul 20, 2022
eab2cf8
update readme
Hirogen Jul 20, 2022
b60a6b0
Trying to apply a darker style
jlrouzies-mantu Jul 26, 2022
d59bff9
implement dark mode as setting
jlrouzies-mantu Jul 26, 2022
92c3a86
Converting more to dark mode
jlrouzies-mantu Jul 26, 2022
8a95220
Added more menu items
jlrouzies-mantu Jul 26, 2022
b0af787
move color mode to config
jlrouzies-mantu Jul 26, 2022
d3b758c
Change approach: update colors after initizalize
jlrouzies-mantu Jul 26, 2022
12df0bc
Set title bar dark mode
jlrouzies-mantu Jul 26, 2022
f898e2a
improve menus parsing
jlrouzies-mantu Jul 26, 2022
3461957
separate forms extensions and move to correct folder
jlrouzies-mantu Jul 26, 2022
c138681
update project file
jlrouzies-mantu Jul 26, 2022
a0407db
Apply dark / bright theme based on color palette
jlrouzies-mantu Jul 26, 2022
e2e98ea
Apply style to menu in datagrid
jlrouzies-mantu Jul 26, 2022
272fc32
Adjust default line background
jlrouzies-mantu Jul 26, 2022
52052e6
Color dataGrid columns, trying foreground no success
jlrouzies-mantu Jul 26, 2022
0a78ecd
Fixed specific separators
jlrouzies-mantu Jul 26, 2022
9e1ebfd
fix default text color
jlrouzies-mantu Jul 27, 2022
ab188a1
Apply theme to tabs menu and bookmarks
jlrouzies-mantu Jul 27, 2022
dbc112d
Improve menus hover colors
jlrouzies-mantu Jul 27, 2022
c22f57a
Apply style to tabs
jlrouzies-mantu Jul 27, 2022
7855d4b
Rename class
jlrouzies-mantu Jul 27, 2022
8b26241
Fixed menus borders and timeshift background
jlrouzies-mantu Jul 27, 2022
076c103
Moved tab code in region
jlrouzies-mantu Jul 27, 2022
027cd52
fix toolstrip visible border
jlrouzies-mantu Jul 27, 2022
a91007d
Apply style to no bookmarks background
jlrouzies-mantu Jul 27, 2022
875c8af
Apply style to more menu strips
jlrouzies-mantu Jul 27, 2022
f820fc5
Fixed pro filters alignment and logo for colors
jlrouzies-mantu Jul 27, 2022
face6f0
Fix filter textbox background
jlrouzies-mantu Jul 27, 2022
0d0791a
Apply color to bookmark cells
jlrouzies-mantu Jul 27, 2022
c70d908
Remove unused new comment code
jlrouzies-mantu Jul 28, 2022
6e88e19
Log error if happens
jlrouzies-mantu Jul 28, 2022
adbcd03
Small code cleaning
jlrouzies-mantu Jul 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# LogExpert [![Build status](https://ci.appveyor.com/api/projects/status/hxwxyyxy81l4tee8/branch/master?svg=true)](https://ci.appveyor.com/project/Zarunbal/logexpert/branch/master)

Clone from https://logexpert.codeplex.com/
This is a clone from (no longer exists) https://logexpert.codeplex.com/

# Overview
LogExpert is a Windows tail program (a GUI replacement for the Unix tail command).
Expand All @@ -21,6 +21,7 @@ Summary of (most) features:
* Plugin API for more log file data sources
* Automatical determine columnizer with given file name and content (Experimental)
* Serilog.Formatting.Compact format support (Experimental)
* Portable (all options / settings saved in application startup directory)

# Download
Follow the [Link](https://github.com/zarunbal/LogExpert/releases/latest) and download the latest package. Just extract it where you want and execute the application or download the Setup and install it
Expand Down Expand Up @@ -56,3 +57,13 @@ Nuke.build Requirements
Please checkout the wiki for FAQ / HELP / Informations / Examples

https://github.com/zarunbal/LogExpert/wiki

## Credits
### Contributors

This project exists thanks to all the people who contribute.
<a href="https://github.com/zarunbal/LogExpert/graphs/contributors">
<img src="https://contrib.rocks/image?repo=zarunbal/LogExpert" />
</a>

Made with [contrib.rocks](https://contrib.rocks).
4 changes: 2 additions & 2 deletions src/LogExpert/Classes/PaintHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void CellPainting(ILogPaintContext logPaintCtx, DataGridView gridV
}
else
{
Color bgColor = Color.White;
Color bgColor = LogExpert.Config.ColorMode.DockBackgroundColor;
if (!DebugOptions.disableWordHighlight)
{
if (entry != null)
Expand Down Expand Up @@ -311,7 +311,7 @@ private static void PaintHighlightedCell(ILogPaintContext logPaintCtx, DataGridV
HilightMatchEntry hme = new HilightMatchEntry();
hme.StartPos = 0;
hme.Length = column.FullValue.Length;
hme.HilightEntry = new HilightEntry(column.FullValue, groundEntry?.ForegroundColor ?? Color.FromKnownColor(KnownColor.Black), groundEntry?.BackgroundColor ?? Color.Empty, false);
hme.HilightEntry = new HilightEntry(column.FullValue, groundEntry?.ForegroundColor ?? LogExpert.Config.ColorMode.ForeColor, groundEntry?.BackgroundColor ?? Color.Empty, false);
matchList = MergeHighlightMatchEntries(matchList, hme);
}
}
Expand Down
115 changes: 115 additions & 0 deletions src/LogExpert/Config/ColorMode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;

namespace LogExpert.Config
{
public static class ColorMode
{
// Bright Theme
// https://paletton.com/#uid=15-0u0k00sH00kJ0pq+00RL00RL
private static readonly Color BrightBookmarkDefaultSystemColor = SystemColors.Control; // Important: only supports SystemColors
private static readonly Color LessBrightBackgroundColor = Color.FromArgb(208, 205, 206);
private static readonly Color BrightBackgroundColor = Color.FromArgb(221, 221, 221);
private static readonly Color BrighterBackgroundColor = Color.FromArgb(253, 253, 253);
private static readonly Color BrightForeColor = Color.FromArgb(0, 0, 0);

// Dark Theme
// https://paletton.com/#uid=15-0u0k005U0670008J003Y003Y
private static readonly Color DarkBookmarkDefaultSystemColor = SystemColors.ControlDarkDark; // Important: only supports SystemColors
private static readonly Color LessLessDarkBackgroundColor = Color.FromArgb(90, 90, 90);
private static readonly Color LessDarkBackgroundColor = Color.FromArgb(67, 67, 67);
private static readonly Color DarkBackgroundColor = Color.FromArgb(45, 45, 45);
private static readonly Color DarkerBackgroundColor = Color.FromArgb(30, 30, 30);
private static readonly Color DarkForeColor = Color.FromArgb(255, 255, 255);

// Default
public static Color BackgroundColor = LessBrightBackgroundColor;
public static Color DockBackgroundColor = BrighterBackgroundColor;
public static Color BookmarksDefaultBackgroundColor = BrightBookmarkDefaultSystemColor;
public static Color ForeColor = BrightForeColor;
public static Color MenuBackgroundColor = BrighterBackgroundColor;
public static Color HoverMenuBackgroundColor = LessBrightBackgroundColor;
public static Color ActiveTabColor = BrighterBackgroundColor;
public static Color InactiveTabColor = LessBrightBackgroundColor;
public static Color TabsBackgroundStripColor = LessBrightBackgroundColor;


public static bool DarkModeEnabled = false;

public static void LoadColorMode()
{
var preferences = Config.ConfigManager.Settings.preferences;

if (preferences.darkMode)
{
SetDarkMode();
}
else
{
SetBrightMode();
}
}

private static void SetDarkMode()
{
BackgroundColor = DarkBackgroundColor;
ForeColor = DarkForeColor;
MenuBackgroundColor = DarkerBackgroundColor;
DockBackgroundColor = LessDarkBackgroundColor;
HoverMenuBackgroundColor = LessDarkBackgroundColor;
BookmarksDefaultBackgroundColor = DarkBookmarkDefaultSystemColor;
TabsBackgroundStripColor = LessDarkBackgroundColor;
ActiveTabColor = LessLessDarkBackgroundColor;
InactiveTabColor = LessDarkBackgroundColor;
DarkModeEnabled = true;
}

private static void SetBrightMode()
{
BackgroundColor = BrightBackgroundColor;
ForeColor = BrightForeColor;
MenuBackgroundColor = BrighterBackgroundColor;
DockBackgroundColor = BrighterBackgroundColor;
BookmarksDefaultBackgroundColor = BrightBookmarkDefaultSystemColor;
HoverMenuBackgroundColor = LessBrightBackgroundColor;
TabsBackgroundStripColor = BrighterBackgroundColor;
ActiveTabColor = BrighterBackgroundColor;
InactiveTabColor = LessBrightBackgroundColor;
DarkModeEnabled = false;
}

#region TitleBarDarkMode
[DllImport("dwmapi.dll")]
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize);

private const int DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 = 19;
private const int DWMWA_USE_IMMERSIVE_DARK_MODE = 20;

public static bool UseImmersiveDarkMode(IntPtr handle, bool enabled)
{

var attribute = DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1;
if (IsWindows10OrGreater(18985))
{
attribute = DWMWA_USE_IMMERSIVE_DARK_MODE;
}

int useImmersiveDarkMode = enabled ? 1 : 0;
return DwmSetWindowAttribute(handle, (int)attribute, ref useImmersiveDarkMode, sizeof(int)) == 0;

}

private static bool IsWindows10OrGreater(int build = -1)
{
return Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build >= build;
}

#endregion TitleBarDarkMode

}
}
2 changes: 2 additions & 0 deletions src/LogExpert/Config/Preferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class Preferences

public bool askForClose = false;

public bool darkMode = false;

public int bufferCount = 100;

public List<ColumnizerMaskEntry> columnizerMaskList = new List<ColumnizerMaskEntry>();
Expand Down
125 changes: 115 additions & 10 deletions src/LogExpert/Controls/LogTabWindow/LogTabWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ public partial class LogTabWindow : Form

public LogTabWindow(string[] fileNames, int instanceNumber, bool showInstanceNumbers)
{
InitializeComponent();
InitializeComponent();

ChangeTheme(Controls);

_startupFileNames = fileNames;
this._instanceNumber = instanceNumber;
this._showInstanceNumbers = showInstanceNumbers;
Expand All @@ -83,7 +86,7 @@ public LogTabWindow(string[] fileNames, int instanceNumber, bool showInstanceNum
HilightGroupList = ConfigManager.Settings.hilightGroupList;

Rectangle led = new Rectangle(0, 0, 8, 2);

for (int i = 0; i < _leds.Length; ++i)
{
_leds[i] = led;
Expand All @@ -97,27 +100,27 @@ public LogTabWindow(string[] fileNames, int instanceNumber, bool showInstanceNum
_ledBrushes[2] = new SolidBrush(Color.FromArgb(255, 0, 220, 0));
_ledBrushes[3] = new SolidBrush(Color.FromArgb(255, 0, 220, 0));
_ledBrushes[4] = new SolidBrush(Color.FromArgb(255, 0, 220, 0));

_offLedBrush = new SolidBrush(Color.FromArgb(grayAlpha, 160, 160, 160));

_dirtyLedBrush = new SolidBrush(Color.FromArgb(255, 220, 0, 00));

_tailLedBrush[0] = new SolidBrush(Color.FromArgb(255, 50, 100, 250)); // Follow tail: blue-ish
_tailLedBrush[1] = new SolidBrush(Color.FromArgb(grayAlpha, 160, 160, 160)); // Don't follow tail: gray
_tailLedBrush[2] = new SolidBrush(Color.FromArgb(255, 220, 220, 0)); // Stop follow tail (trigger): yellow-ish

_syncLedBrush = new SolidBrush(Color.FromArgb(255, 250, 145, 30));

CreateIcons();

_tabStringFormat.LineAlignment = StringAlignment.Center;
_tabStringFormat.Alignment = StringAlignment.Near;

ToolStripControlHost host = new ToolStripControlHost(checkBoxFollowTail);

host.Padding = new Padding(20, 0, 0, 0);
host.BackColor = Color.FromKnownColor(KnownColor.Transparent);

int index = buttonToolStrip.Items.IndexOfKey("toolStripButtonTail");

toolStripEncodingASCIIItem.Text = Encoding.ASCII.HeaderName;
Expand Down Expand Up @@ -151,6 +154,108 @@ public LogTabWindow(string[] fileNames, int instanceNumber, bool showInstanceNum

#endregion

#region ColorTheme
public void ChangeTheme(Control.ControlCollection container)
{
LogExpert.Config.ColorMode.LoadColorMode();
LogExpert.Config.ColorMode.UseImmersiveDarkMode(this.Handle, LogExpert.Config.ColorMode.DarkModeEnabled);

#region ApplyColorToAllControls
foreach (Control component in container)
{
if (component.Controls != null && component.Controls.Count > 0)
{
ChangeTheme(component.Controls);
component.BackColor = LogExpert.Config.ColorMode.BackgroundColor;
component.ForeColor = LogExpert.Config.ColorMode.ForeColor;
}
else
{
component.BackColor = LogExpert.Config.ColorMode.BackgroundColor;
component.ForeColor = LogExpert.Config.ColorMode.ForeColor;
}

if (component is MenuStrip)
{
var menu = (MenuStrip)component;

foreach (ToolStripMenuItem item in menu.Items)
{
item.ForeColor = LogExpert.Config.ColorMode.ForeColor;
item.BackColor = LogExpert.Config.ColorMode.BackgroundColor;

try
{
for(var x = 0; x< item.DropDownItems.Count; x++)
{
var children = item.DropDownItems[x];
children.ForeColor = LogExpert.Config.ColorMode.ForeColor;
children.BackColor = LogExpert.Config.ColorMode.MenuBackgroundColor;


if(children is ToolStripDropDownItem) {

for (var y = 0; y < ((ToolStripDropDownItem)children).DropDownItems.Count; y++)
{
var subChildren = ((ToolStripDropDownItem)children).DropDownItems[y];
subChildren.ForeColor = LogExpert.Config.ColorMode.ForeColor;
subChildren.BackColor = LogExpert.Config.ColorMode.MenuBackgroundColor;
}
}
}
}
catch (Exception ex)
{
_logger.Error(ex, "An error occured while applying style dynamically to all Controls under LogTabWindow:");
}
}
}
}
#endregion

// Colors for selected menus
mainMenuStrip.Renderer = new LogExpert.Extensions.ExtendedMenuStripRenderer();

// Dock special color
dockPanel.DockBackColor = LogExpert.Config.ColorMode.DockBackgroundColor;

// Remove toolstrip bottom border
buttonToolStrip.Renderer = new LogExpert.Extensions.ToolStripRendererExtension();

#region Tabs
tabContextMenuStrip.Renderer = new LogExpert.Extensions.ExtendedMenuStripRenderer();

// Tabs menu
for (var y = 0; y < tabContextMenuStrip.Items.Count; y++)
{
var item = tabContextMenuStrip.Items[y];
item.ForeColor = LogExpert.Config.ColorMode.ForeColor;
item.BackColor = LogExpert.Config.ColorMode.MenuBackgroundColor;
}

// Tabs line
dockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.StartColor = LogExpert.Config.ColorMode.TabsBackgroundStripColor;
dockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.EndColor = LogExpert.Config.ColorMode.TabsBackgroundStripColor;

dockPanel.Skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.StartColor = LogExpert.Config.ColorMode.TabsBackgroundStripColor;
dockPanel.Skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.EndColor = LogExpert.Config.ColorMode.TabsBackgroundStripColor;

// Tabs
dockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.StartColor = LogExpert.Config.ColorMode.ActiveTabColor;
dockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.EndColor = LogExpert.Config.ColorMode.ActiveTabColor;
dockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.TextColor = LogExpert.Config.ColorMode.ForeColor;

dockPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.StartColor = LogExpert.Config.ColorMode.ActiveTabColor;
dockPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.EndColor = LogExpert.Config.ColorMode.ActiveTabColor;
dockPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.TextColor = LogExpert.Config.ColorMode.ForeColor;

dockPanel.Skin.DockPaneStripSkin.DocumentGradient.InactiveTabGradient.StartColor = LogExpert.Config.ColorMode.InactiveTabColor;
dockPanel.Skin.DockPaneStripSkin.DocumentGradient.InactiveTabGradient.EndColor = LogExpert.Config.ColorMode.InactiveTabColor;
dockPanel.Skin.DockPaneStripSkin.DocumentGradient.InactiveTabGradient.TextColor = LogExpert.Config.ColorMode.ForeColor;
#endregion Tabs
}
#endregion

#region Delegates

private delegate void AddFileTabsDelegate(string[] fileNames);
Expand Down
Loading