Skip to content

Commit

Permalink
feat(clients): theme based icons for better visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Blarc committed Nov 13, 2024
1 parent e24f642 commit 1d76214
Show file tree
Hide file tree
Showing 18 changed files with 47 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Support streaming mode for Gemini Google.
- Support GitHub models client.
- Theme based icons for better visibility.

### Fixed

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
package com.github.blarc.ai.commits.intellij.plugin

import com.intellij.openapi.util.IconLoader
import com.intellij.ui.JBColor
import javax.swing.Icon

object Icons {
val AI_COMMITS = IconLoader.getIcon("/icons/aiCommits15.svg", javaClass)
val OPEN_AI = IconLoader.getIcon("/icons/openai.svg", javaClass)
val OLLAMA = IconLoader.getIcon("/icons/ollama15.svg", javaClass)
val QIANFAN = IconLoader.getIcon("/icons/qianfan.png", javaClass)
val GEMINI_VERTEX = IconLoader.getIcon("/icons/geminiVertex.svg", javaClass)
val GEMINI_GOOGLE = IconLoader.getIcon("/icons/geminiGoogle.svg", javaClass)
val ANTHROPIC = IconLoader.getIcon("/icons/anthropic.svg", javaClass)
val AZURE_OPEN_AI = IconLoader.getIcon("/icons/azureOpenAi.svg", javaClass)
val HUGGING_FACE = IconLoader.getIcon("/icons/huggingface.svg", javaClass)
val GITHUB = IconLoader.getIcon("/icons/github15.svg", javaClass)

data class AICommitsIcon(val bright: String, val dark: String?) {

fun getThemeBasedIcon(): Icon {
return if (JBColor.isBright() || dark == null) {
IconLoader.getIcon(bright, javaClass)
} else {
IconLoader.getIcon(dark, javaClass)
}
}
}

val AI_COMMITS = AICommitsIcon("/icons/aiCommits15.svg", null)
val OPEN_AI = AICommitsIcon("/icons/openai15bright.svg", "/icons/openai15dark.png")
val OLLAMA = AICommitsIcon("/icons/ollama15.svg", null)
val QIANFAN = AICommitsIcon("/icons/qianfan.png", null)
val GEMINI_VERTEX = AICommitsIcon("/icons/geminiVertex.svg", null)
val GEMINI_GOOGLE = AICommitsIcon("/icons/geminiGoogle.svg", null)
val ANTHROPIC = AICommitsIcon("/icons/anthropic15bright.svg", "/icons/anthropic15dark.png")
val AZURE_OPEN_AI = AICommitsIcon("/icons/azureOpenAi.svg", null)
val HUGGING_FACE = AICommitsIcon("/icons/huggingface.svg", null)
val GITHUB = AICommitsIcon("/icons/github15bright.svg", "/icons/github15dark.svg")
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fun sendNotification(notification : Notification, project : Project? = null) {
NotificationType.INFORMATION
)

intellijNotification.icon = Icons.AI_COMMITS
intellijNotification.icon = Icons.AI_COMMITS.getThemeBasedIcon()

notification.actions.forEach { action ->
intellijNotification.addAction(DumbAwareAction.create(action.title) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AnthropicClientConfiguration : LLMClientConfiguration(
}

override fun getClientIcon(): Icon {
return Icons.ANTHROPIC
return Icons.ANTHROPIC.getThemeBasedIcon()
}

override fun getSharedState(): LLMClientSharedState {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.blarc.ai.commits.intellij.plugin.settings.clients.azureOpenAi;
package com.github.blarc.ai.commits.intellij.plugin.settings.clients.azureOpenAi

import com.github.blarc.ai.commits.intellij.plugin.Icons
import com.github.blarc.ai.commits.intellij.plugin.settings.clients.LLMClientConfiguration
Expand Down Expand Up @@ -34,7 +34,7 @@ class AzureOpenAiClientConfiguration : LLMClientConfiguration(
}

override fun getClientIcon(): Icon {
return Icons.AZURE_OPEN_AI
return Icons.AZURE_OPEN_AI.getThemeBasedIcon()
}

override fun getSharedState(): LLMClientSharedState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class GeminiGoogleClientConfiguration : LLMClientConfiguration(
}

override fun getClientIcon(): Icon {
return Icons.GEMINI_GOOGLE
return Icons.GEMINI_GOOGLE.getThemeBasedIcon()
}

override fun getSharedState(): LLMClientSharedState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class GeminiClientConfiguration : LLMClientConfiguration(
}

override fun getClientIcon(): Icon {
return Icons.GEMINI_VERTEX
return Icons.GEMINI_VERTEX.getThemeBasedIcon()
}

override fun getSharedState(): LLMClientSharedState {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.blarc.ai.commits.intellij.plugin.settings.clients.githubModels;
package com.github.blarc.ai.commits.intellij.plugin.settings.clients.githubModels

import com.github.blarc.ai.commits.intellij.plugin.Icons
import com.github.blarc.ai.commits.intellij.plugin.settings.clients.LLMClientConfiguration
Expand Down Expand Up @@ -32,7 +32,7 @@ class GitHubModelsClientConfiguration : LLMClientConfiguration(
}

override fun getClientIcon(): Icon {
return Icons.GITHUB
return Icons.GITHUB.getThemeBasedIcon()
}

override fun getSharedState(): LLMClientSharedState {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.blarc.ai.commits.intellij.plugin.settings.clients.huggingface;
package com.github.blarc.ai.commits.intellij.plugin.settings.clients.huggingface

import com.github.blarc.ai.commits.intellij.plugin.Icons
import com.github.blarc.ai.commits.intellij.plugin.settings.clients.LLMClientConfiguration
Expand Down Expand Up @@ -37,7 +37,7 @@ class HuggingFaceClientConfiguration : LLMClientConfiguration(
}

override fun getClientIcon(): Icon {
return Icons.HUGGING_FACE
return Icons.HUGGING_FACE.getThemeBasedIcon()
}

override fun getSharedState(): LLMClientSharedState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class OllamaClientConfiguration : LLMClientConfiguration(
}

override fun getClientIcon(): Icon {
return Icons.OLLAMA
return Icons.OLLAMA.getThemeBasedIcon()
}

override fun getSharedState(): LLMClientSharedState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class OpenAiClientConfiguration : LLMClientConfiguration(
}

override fun getClientIcon(): Icon {
return Icons.OPEN_AI
return Icons.OPEN_AI.getThemeBasedIcon()
}

override fun getSharedState(): OpenAiClientSharedState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class QianfanClientConfiguration : LLMClientConfiguration(
}

override fun getClientIcon(): Icon {
return Icons.QIANFAN
return Icons.QIANFAN.getThemeBasedIcon()
}

override fun getSharedState(): QianfanClientSharedState {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/anthropic15dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/main/resources/icons/github15dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/openai15dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1d76214

Please sign in to comment.