Skip to content

Commit 4554727

Browse files
committed
refactor(devti): improve UI styling and remove unnecessary comments
- Remove unused comments in AutoDevInlineChatPanel- Enhance task label styling in TaskStepPanel - Update reviewer icon color ``` refactor(ui): improve task label styling and theme consistency - Removed redundant comments and improved task label styling in TaskStepPanel. - Added theme-aware background and foreground colors, and editor font settings. - Updated HTML structure for better consistency with theme styles
1 parent 26bf2ed commit 4554727

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

core/src/main/kotlin/cc/unitmesh/devti/inline/AutoDevInlineChatPanel.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ class AutoDevInlineChatInput(
268268

269269
border = AutoDevLineBorder(CurrentTheme.Focus.focusColor(), 1, true, 2)
270270

271-
// escape to close
272271
textArea.actionMap.put("escapeAction", object : AbstractAction() {
273272
override fun actionPerformed(e: ActionEvent) {
274273
cancel()
@@ -283,7 +282,6 @@ class AutoDevInlineChatInput(
283282
}
284283
})
285284
textArea.inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enterAction")
286-
// newLine with shift + enter
287285
textArea.actionMap.put("newlineAction", object : AbstractAction() {
288286
override fun actionPerformed(e: ActionEvent) {
289287
textArea.append("\n")

core/src/main/kotlin/cc/unitmesh/devti/sketch/ui/plan/TaskStepPanel.kt

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ import cc.unitmesh.devti.gui.AutoDevToolWindowFactory
77
import cc.unitmesh.devti.gui.chat.message.ChatActionType
88
import cc.unitmesh.devti.observer.plan.AgentPlanStep
99
import cc.unitmesh.devti.observer.plan.TaskStatus
10+
import com.intellij.ide.ui.UISettings
11+
import com.intellij.openapi.editor.colors.EditorColorsManager
1012
import com.intellij.openapi.fileEditor.FileEditorManager
1113
import com.intellij.openapi.project.Project
1214
import com.intellij.openapi.vfs.LocalFileSystem
15+
import com.intellij.ui.ColorUtil
1316
import com.intellij.ui.components.JBCheckBox
1417
import com.intellij.ui.components.JBPanel
1518
import com.intellij.util.ui.JBUI
19+
import com.intellij.util.ui.UIUtil
1620
import java.awt.Dimension
1721
import javax.swing.BorderFactory
1822
import javax.swing.BoxLayout
@@ -90,19 +94,31 @@ class TaskStepPanel(
9094

9195
private fun createStyledTaskLabel(): JEditorPane {
9296
val labelText = getLabelTextByStatus()
97+
98+
val backgroundColor = UIUtil.getPanelBackground()
99+
val backgroundColorHex = ColorUtil.toHex(backgroundColor)
100+
101+
// Get the foreground color that matches the current theme
102+
val foregroundColor = UIUtil.getLabelForeground()
103+
val foregroundColorHex = ColorUtil.toHex(foregroundColor)
104+
105+
val editorColorsManager = EditorColorsManager.getInstance()
106+
val currentScheme = editorColorsManager.schemeForCurrentUITheme
107+
val editorFontName = currentScheme.editorFontName
108+
val editorFontSize = currentScheme.editorFontSize
93109

94110
return JEditorPane().apply {
95111
contentType = "text/html"
96112

97113
val editorKit = HTMLEditorKit()
98114
val styleSheet = StyleSheet()
115+
styleSheet.addRule("body { font-family: '$editorFontName'; font-size: ${editorFontSize}pt; background-color: #$backgroundColorHex; color: #$foregroundColorHex; }")
99116
styleSheet.addRule("a { color: #3366CC; text-decoration: underline; }")
100117
styleSheet.addRule("a:hover { color: #3366CC; }")
101118
editorKit.styleSheet = styleSheet
102119

103120
this.editorKit = editorKit
104121

105-
// Get the document after setting the editorKit to ensure proper connection
106122
val document = this.document as HTMLDocument
107123
document.putProperty("IgnoreCharsetDirective", true)
108124
project.basePath?.let {
@@ -112,10 +128,9 @@ class TaskStepPanel(
112128

113129
border = JBUI.Borders.emptyLeft(5)
114130
isEditable = false
115-
background = JBUI.CurrentTheme.ToolWindow.background()
131+
background = backgroundColor
116132

117-
// Set text after stylesheet is applied
118-
text = "<html>$labelText</html>"
133+
text = "<html><body>$labelText</body></html>"
119134

120135
addHyperlinkListener { e ->
121136
if (e.eventType == HyperlinkEvent.EventType.ACTIVATED) {

core/src/main/resources/icons/reviewer.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)