mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
UI: alternative background color for lists with tall rows
GitOrigin-RevId: bb61dda8f22c12d9eddc4717d0169636245a1f5b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
454fd852c1
commit
0504ee2f4a
@@ -669,6 +669,10 @@
|
||||
{
|
||||
"key": "Table.lightSelectionInactiveForeground"
|
||||
},
|
||||
{
|
||||
"key": "Table.alternativeRowBackground",
|
||||
"description": "Contrast background color for lists with tall rows, e.g. View | Tool Windows | Endpoints"
|
||||
},
|
||||
{
|
||||
"key": "Table.stripeColor"
|
||||
},
|
||||
|
||||
+14
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.util.ui
|
||||
|
||||
import com.intellij.ui.JBColor
|
||||
@@ -7,8 +7,9 @@ import javax.swing.JList
|
||||
|
||||
object ListUiUtil {
|
||||
object WithTallRow {
|
||||
private val selectionBackground = JBColor(0xE9EEF5, 0x464A4D)
|
||||
private val unfocusedSelectionBackground = JBColor(0xF5F5F5, 0x464A4D)
|
||||
private val selectionBackground: JBColor = JBColor(0xE9EEF5, 0x464A4D)
|
||||
private val unfocusedSelectionBackground: JBColor = JBColor(0xF5F5F5, 0x464A4D)
|
||||
private val alternativeRowBackground: JBColor = JBColor(0xFFFFFF, 0x313335)
|
||||
|
||||
fun foreground(isSelected: Boolean, hasFocus: Boolean): Color {
|
||||
val default = UIUtil.getListForeground()
|
||||
@@ -33,5 +34,15 @@ object ListUiUtil {
|
||||
}
|
||||
else list.background
|
||||
}
|
||||
|
||||
fun alternativeBackground(isSelected: Boolean, hasFocus: Boolean): Color {
|
||||
return if (isSelected) {
|
||||
if (hasFocus) JBColor.namedColor("Table.lightSelectionBackground", selectionBackground)
|
||||
else JBColor.namedColor("Table.lightSelectionInactiveBackground", unfocusedSelectionBackground)
|
||||
}
|
||||
else {
|
||||
JBColor.namedColor("Table.alternativeRowBackground", alternativeRowBackground)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user