Use light Codex icon on light themes

This commit is contained in:
Ryan Hughes
2026-06-14 20:09:29 -04:00
parent d8cff94711
commit e0eaf8eea8
2 changed files with 20 additions and 1 deletions
+19 -1
View File
@@ -163,10 +163,28 @@ BarWidget {
usageMain.refreshAll(true)
}
function colorChannelLuminance(value) {
var channel = Number(value)
if (!isFinite(channel)) return 0
return channel <= 0.03928 ? channel / 12.92 : Math.pow((channel + 0.055) / 1.055, 2.4)
}
function colorLuminance(color) {
return 0.2126 * colorChannelLuminance(color.r)
+ 0.7152 * colorChannelLuminance(color.g)
+ 0.0722 * colorChannelLuminance(color.b)
}
function codexIconSource() {
return colorLuminance(foreground) < 0.5
? Qt.resolvedUrl("assets/codex-light.svg")
: Qt.resolvedUrl("assets/codex.svg")
}
function iconSourceForProvider(provider) {
if (!provider) return ""
if (provider.providerId === "claude") return Qt.resolvedUrl("assets/claude.svg")
if (provider.providerId === "codex") return Qt.resolvedUrl("assets/codex.svg")
if (provider.providerId === "codex") return codexIconSource()
return ""
}