Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/brand-color-view-icon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": patch
---

Use brand-colored Kilo Code icons throughout the extension for better visibility
2 changes: 1 addition & 1 deletion src/assets/icons/kilo-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/icons/kilo-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion webview-ui/src/components/chat/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,14 @@ const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0
// kilocode_change start: KiloLogo component
const KiloLogo = () => {
const iconsBaseUri = (window as any).ICONS_BASE_URI || ""
const isLightTheme =
document.body.classList.contains("vscode-light") ||
document.body.classList.contains("vscode-high-contrast-light")
const iconFile = isLightTheme ? "kilo-light.svg" : "kilo-dark.svg"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Chat logo may not update on VS Code theme switch

The light/dark choice is computed during render. If the user changes theme while the webview remains open, this component may not re-render, leaving the icon stuck. Consider subscribing to theme changes (e.g., observing document.body class changes like the Agent Manager logo does).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs the same logic as in KiloLogo i think? But cant we just use KiloLogo component here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markijbema - there must be some other listener, as this one updates automatically as-is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Extension-side listener (ClineProvider.ts:943-948): The VS Code extension listens for workbench.colorTheme configuration changes and sends a { type: "theme", ... } message to the webview.
  2. Context state update (ExtensionStateContext.tsx:458-462): When the webview receives this theme message, it calls setTheme(), updating the context state.
  3. Component re-render: The ChatView component uses useExtensionState() (line 110-133), so when any state in that context changes (including theme), the entire component re-renders.

return (
<div className="flex items-center justify-center" style={{ width: "56px", height: "56px", margin: "0 auto" }}>
<img
src={`${iconsBaseUri}/kilo-dark.svg`}
src={`${iconsBaseUri}/${iconFile}`}
alt="Kilo Code"
className="w-full h-full object-contain"
style={{ opacity: 0.85 }}
Expand Down
19 changes: 17 additions & 2 deletions webview-ui/src/kilocode/agent-manager/components/KiloLogo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
import React from "react"
import React, { useState, useEffect } from "react"

const getIsLightThemeFromEditor = () =>
document.body.classList.contains("vscode-light") || document.body.classList.contains("vscode-high-contrast-light")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Potential document.body null access in getIsLightThemeFromEditor()

document.body is accessed during render; in some environments (early webview boot / non-browser harness) it can be unavailable and cause a hard crash. A defensive check keeps the component resilient.

Suggested change
document.body.classList.contains("vscode-light") || document.body.classList.contains("vscode-high-contrast-light")
!!(document.body && (document.body.classList.contains("vscode-light") || document.body.classList.contains("vscode-high-contrast-light")))


export const KiloLogo = () => {
const [isLightTheme, setIsLightTheme] = useState(getIsLightThemeFromEditor)

useEffect(() => {
const observer = new MutationObserver(() => {
setIsLightTheme(getIsLightThemeFromEditor())
})
observer.observe(document.body, { attributes: true, attributeFilter: ["class"] })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: MutationObserver.observe can throw if document.body is unavailable

If document.body isn't ready for any reason, this call will throw. Guarding the observe call avoids an unhandled exception.

Suggested change
observer.observe(document.body, { attributes: true, attributeFilter: ["class"] })
document.body && observer.observe(document.body, { attributes: true, attributeFilter: ["class"] })

return () => observer.disconnect()
}, [])

const fillColor = isLightTheme ? "#1a1a18" : "#f8f674"

return (
<svg
id="Layer_2"
Expand All @@ -14,7 +29,7 @@ export const KiloLogo = () => {
<path
id="Logo_Outline_-_White"
data-name="Logo Outline - White"
fill="currentColor"
fill={fillColor}
d="M0,0v100h100V0H0ZM92.5925926,92.5925926H7.4074074V7.4074074h85.1851852v85.1851852ZM61.1111044,71.9096084h9.2592593v7.4074074h-11.6402116l-5.026455-5.026455v-11.6402116h7.4074074v9.2592593ZM77.7777711,71.9096084h-7.4074074v-9.2592593h-9.2592593v-7.4074074h11.6402116l5.026455,5.026455v11.6402116ZM46.2962963,61.1114207h-7.4074074v-7.4074074h7.4074074v7.4074074ZM22.2222222,53.7040133h7.4074074v16.6666667h16.6666667v7.4074074h-19.047619l-5.026455-5.026455v-19.047619ZM77.7777711,38.8888889v7.4074074h-24.0740741v-7.4074074h8.2781918v-9.2592593h-8.2781918v-7.4074074h10.6591442l5.026455,5.026455v11.6402116h8.3884749ZM29.6296296,30.5555556h9.2592593l7.4074074,7.4074074v8.3333333h-7.4074074v-8.3333333h-9.2592593v8.3333333h-7.4074074v-24.0740741h7.4074074v8.3333333ZM46.2962963,30.5555556h-7.4074074v-8.3333333h7.4074074v8.3333333Z"
/>
</g>
Expand Down
Loading