Select Codex icon by surface background

This commit is contained in:
Ryan Hughes
2026-06-14 20:14:09 -04:00
parent e0eaf8eea8
commit 8d490d525e
2 changed files with 13 additions and 7 deletions
+7 -7
View File
@@ -175,16 +175,16 @@ BarWidget {
+ 0.0722 * colorChannelLuminance(color.b)
}
function codexIconSource() {
return colorLuminance(foreground) < 0.5
function codexIconSource(surfaceColor) {
return colorLuminance(surfaceColor || Color.background) >= 0.5
? Qt.resolvedUrl("assets/codex-light.svg")
: Qt.resolvedUrl("assets/codex.svg")
}
function iconSourceForProvider(provider) {
function iconSourceForProvider(provider, surfaceColor) {
if (!provider) return ""
if (provider.providerId === "claude") return Qt.resolvedUrl("assets/claude.svg")
if (provider.providerId === "codex") return codexIconSource()
if (provider.providerId === "codex") return codexIconSource(surfaceColor)
return ""
}
@@ -350,7 +350,7 @@ BarWidget {
spacing: 4
Image {
source: root.iconSourceForProvider(chip.modelData)
source: root.iconSourceForProvider(chip.modelData, root.bar ? root.bar.background : Color.bar.background)
width: 13
height: 13
sourceSize.width: 13
@@ -377,7 +377,7 @@ BarWidget {
spacing: 1
Image {
source: root.iconSourceForProvider(chip.modelData)
source: root.iconSourceForProvider(chip.modelData, root.bar ? root.bar.background : Color.bar.background)
width: 13
height: 13
sourceSize.width: 13
@@ -908,7 +908,7 @@ BarWidget {
spacing: 8
Image {
source: root.iconSourceForProvider(provider)
source: root.iconSourceForProvider(provider, root.background)
Layout.preferredWidth: 16
Layout.preferredHeight: 16
sourceSize.width: 16