Remove code that was painting the Prosody log using Windows Console Host
functions. Windows has native support of ANSI colors for a decade, so we don't
need this anymore.


-- 
You received this message because you are subscribed to the Google Groups 
"prosody-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/prosody-dev/3c477e8630623dc3d848.1772987624%40EI08_MatisseX.
# HG changeset patch
# User Vitaly Orekhov <[email protected]>
# Date 1772987454 -10800
#      Sun Mar 08 19:30:54 2026 +0300
# Branch tc_conhost
# Node ID 3c477e8630623dc3d8486f9c40f00bda01f00005
# Parent  d7fdb1395432270bece115585a16213f3097f50d
util.termcolours: Remove leftovers of conhost text painting

Remove code that was painting the Prosody log using Windows Console Host
functions. Windows has native support of ANSI colors for a decade, so we don't
need this anymore.

diff -r d7fdb1395432 -r 3c477e863062 util/termcolours.lua
--- a/util/termcolours.lua	Thu Mar 05 10:24:56 2026 -0500
+++ b/util/termcolours.lua	Sun Mar 08 19:30:54 2026 +0300
@@ -18,13 +18,6 @@
 local type = type;
 local setmetatable = setmetatable;
 local pairs = pairs;
-
-local windows;
-if os.getenv("WINDIR") then
-	windows = require "prosody.util.windows";
-end
-local orig_color = windows and windows.get_consolecolor and windows.get_consolecolor();
-
 local _ENV = nil;
 -- luacheck: std none
 
@@ -36,13 +29,6 @@
 			bold = 1, dark = 2, underline = 4, underlined = 4, normal = 0;
 		}
 
-local winstylemap = {
-	["0"] = orig_color, -- reset
-	["1"] = 7+8, -- bold
-	["1;33"] = 2+4+8, -- bold yellow
-	["1;31"] = 4+8 -- bold red
-}
-
 local cssmap = {
 	[1] = "font-weight: bold", [2] = "opacity: 0.5", [4] = "text-decoration: underline", [8] = "visibility: hidden",
 	[30] = "color:black", [31] = "color:red", [32]="color:green", [33]="color:#FFD700",
@@ -118,19 +104,6 @@
 	end
 end
 
-if windows then
-	function setstyle(style)
-		style = style or "0";
-		if style ~= last then
-			windows.set_consolecolor(winstylemap[style] or orig_color);
-			last = style;
-		end
-	end
-	if not orig_color then
-		function setstyle() end
-	end
-end
-
 local function ansi2css(ansi_codes)
 	if ansi_codes == "0" then return "</span>"; end
 	local css = {};

Reply via email to