Use proper OpenCode icon
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { ItemView, WorkspaceLeaf, setIcon } from "obsidian";
|
||||
import { OPENCODE_VIEW_TYPE } from "./types";
|
||||
import { OPENCODE_ICON_NAME } from "./icons";
|
||||
import type OpenCodePlugin from "./main";
|
||||
import { ProcessState } from "./ProcessManager";
|
||||
|
||||
@@ -22,7 +23,7 @@ export class OpenCodeView extends ItemView {
|
||||
}
|
||||
|
||||
getIcon(): string {
|
||||
return "terminal";
|
||||
return OPENCODE_ICON_NAME;
|
||||
}
|
||||
|
||||
async onOpen(): Promise<void> {
|
||||
@@ -120,7 +121,7 @@ export class OpenCodeView extends ItemView {
|
||||
|
||||
const titleSection = headerEl.createDiv({ cls: "opencode-header-title" });
|
||||
const iconEl = titleSection.createSpan();
|
||||
setIcon(iconEl, "terminal");
|
||||
setIcon(iconEl, OPENCODE_ICON_NAME);
|
||||
titleSection.createSpan({ text: "OpenCode" });
|
||||
|
||||
const actionsEl = headerEl.createDiv({ cls: "opencode-header-actions" });
|
||||
|
||||
14
src/icons.ts
Normal file
14
src/icons.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { addIcon } from "obsidian";
|
||||
|
||||
export const OPENCODE_ICON_NAME = "opencode-logo";
|
||||
|
||||
// Monochrome OpenCode "O" logo mark derived from the official brand assets
|
||||
// Uses currentColor for theme compatibility
|
||||
const OPENCODE_LOGO_SVG = `<svg viewBox="0 0 24 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M18 24H6V12H18V24Z" fill="currentColor" opacity="0.4"/>
|
||||
<path d="M18 6H6V24H18V6ZM24 30H0V0H24V30Z" fill="currentColor"/>
|
||||
</svg>`;
|
||||
|
||||
export function registerOpenCodeIcons(): void {
|
||||
addIcon(OPENCODE_ICON_NAME, OPENCODE_LOGO_SVG);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { OpenCodeSettings, DEFAULT_SETTINGS, OPENCODE_VIEW_TYPE } from "./types"
|
||||
import { OpenCodeView } from "./OpenCodeView";
|
||||
import { OpenCodeSettingTab } from "./SettingsTab";
|
||||
import { ProcessManager, ProcessState } from "./ProcessManager";
|
||||
import { registerOpenCodeIcons, OPENCODE_ICON_NAME } from "./icons";
|
||||
|
||||
export default class OpenCodePlugin extends Plugin {
|
||||
settings: OpenCodeSettings = DEFAULT_SETTINGS;
|
||||
@@ -12,6 +13,9 @@ export default class OpenCodePlugin extends Plugin {
|
||||
async onload(): Promise<void> {
|
||||
console.log("Loading OpenCode plugin");
|
||||
|
||||
// Register custom icons
|
||||
registerOpenCodeIcons();
|
||||
|
||||
await this.loadSettings();
|
||||
|
||||
// Get the vault directory path to pass to OpenCode
|
||||
@@ -33,7 +37,7 @@ export default class OpenCodePlugin extends Plugin {
|
||||
this.registerView(OPENCODE_VIEW_TYPE, (leaf) => new OpenCodeView(leaf, this));
|
||||
|
||||
// Add ribbon icon
|
||||
this.addRibbonIcon("terminal", "OpenCode", () => {
|
||||
this.addRibbonIcon(OPENCODE_ICON_NAME, "OpenCode", () => {
|
||||
this.activateView();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user