Favorites Tree, can't see Expand Branch symbol (due to colour)

Bugs and issues - current donor version.
Post Reply
Message
Author
Dr_Eyeball
Posts: 4
Joined: 19.10.2024, 02:09

Favorites Tree, can't see Expand Branch symbol (due to colour)

#1 Post by Dr_Eyeball » 19.08.2025, 02:11

A daily side-effect style bug, in FreeCommander XE 2025 Build 934 64-bit donor.

Problem:
In the Favorites Tree Panel & Tree Panel, I can't see the "Expand Branch" and "Outline" symbols.

I have always used a black background for all editors and focused lists, which is similar to a "Dark-Theme" of modern applications.
When focused, the "Expand Branch" symbols are not visible, and the "Outline" symbols are barely visible.
When not focused, the "Expand Branch" symbols are visible, and the "Outline" symbols are not visible.

Solution:
  1. Consider adding a colour definition to settings.
  2. Or, adjust the "Expand Branch" color to match the "Outline" color
  3. Or preferably, adjust the "Expand Branch" color & "Outline" colors to automatically contrast against the chosen background color brightness. (See end of post for brightness related info.)
    • Code: Select all

      if brightnessPercent < 15 then
          setSymbolColor("Grey70")  -- Very dark background → light grey text
      elseif brightnessPercent < 35 then
          setSymbolColor("Grey60")  -- Dark background → medium-light text
      elseif brightnessPercent < 50 then
          setSymbolColor("Grey40")  -- Mid-dark background → medium text
      elseif brightnessPercent < 70 then
          setSymbolColor("Grey20")  -- Mid-light background → darker text
      elseif brightnessPercent < 85 then
          setSymbolColor("Grey10")  -- Light background → very dark text
      else
          setSymbolColor("Black")   -- Very light background → pure black text
      end

"Expand Branch" symbols are not visible. "Outline" symbols are barely visible.
"Expand Branch" symbols & "Outline" symbols are still visible.
According to CoPilot AI:
To determine the "brightness percentage" of a background color in a UI, you can use a perceptual formula that converts RGB values into a single luminance value—essentially estimating how bright the color appears to the human eye.

🌈 Step-by-Step: Brightness from RGB

Assuming your color is defined as:

Code: Select all

local r, g, b = 120, 200, 255  -- Example RGB values
You can calculate brightness using the "ITU-R BT.601 luma formula", which weights each channel based on human sensitivity:

Code: Select all

local brightness = (0.299 * r + 0.587 * g + 0.114 * b) / 255
local brightnessPercent = math.floor(brightness * 100 + 0.5)
📊 What This Means
  • The result is a percentage from 0 to 100.
  • `0%` = pure black, `100%` = pure white.
  • This formula reflects how humans perceive brightness—green contributes most, blue least.
🧠 How this Benefits a UI
  • You can use this to auto-adjust text color (e.g., switch to white text on dark backgrounds).
  • It helps with accessibility, ensuring contrast ratios meet WCAG standards.
  • You can also use it to fade or highlight UI elements based on background brightness.
🛠️ Sample Utility Function

Code: Select all

function GetBrightnessPercent(r, g, b)
	local luminance = 0.299 * r + 0.587 * g + 0.114 * b
	return math.floor((luminance / 255) * 100 + 0.5)
end

Post Reply

Who is online

Users browsing this forum: No registered users and 66 guests