-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
408 additions
and
796 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 8 additions & 45 deletions
53
...af-bridge/ide-laf-bridge-232/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeIconData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,18 @@ | ||
package org.jetbrains.jewel.bridge | ||
|
||
import androidx.compose.runtime.Immutable | ||
import com.intellij.ide.ui.UITheme | ||
import com.intellij.ui.ColorUtil | ||
import org.jetbrains.jewel.InternalJewelApi | ||
import org.jetbrains.jewel.ThemeIconData | ||
|
||
@Immutable | ||
@InternalJewelApi | ||
class BridgeIconData( | ||
override val iconOverrides: Map<String, String>, | ||
override val colorPalette: Map<String, String>, | ||
override val selectionColorPalette: Map<String, Int>, | ||
) : ThemeIconData { | ||
|
||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (javaClass != other?.javaClass) return false | ||
|
||
other as BridgeIconData | ||
|
||
if (iconOverrides != other.iconOverrides) return false | ||
if (colorPalette != other.colorPalette) return false | ||
if (selectionColorPalette != other.selectionColorPalette) return false | ||
|
||
return true | ||
} | ||
|
||
override fun hashCode(): Int { | ||
var result = iconOverrides.hashCode() | ||
result = 31 * result + colorPalette.hashCode() | ||
result = 31 * result + selectionColorPalette.hashCode() | ||
return result | ||
@OptIn(InternalJewelApi::class) | ||
fun ThemeIconData.Companion.readFromLaF(): ThemeIconData { | ||
val uiTheme = currentUiThemeOrNull() | ||
val iconMap = uiTheme?.icons.orEmpty() | ||
val selectedIconColorPalette = uiTheme?.selectedIconColorPalette.orEmpty().mapValues { | ||
ColorUtil.fromHex(it.value).rgb | ||
} | ||
|
||
override fun toString(): String = | ||
"BridgeIconData(iconOverrides=$iconOverrides, colorPalette=$colorPalette, " + | ||
"selectionColorPalette=$selectionColorPalette)" | ||
|
||
companion object { | ||
|
||
@OptIn(InternalJewelApi::class) | ||
fun readFromLaF(): BridgeIconData { | ||
val uiTheme = currentUiThemeOrNull() | ||
val iconMap = uiTheme?.icons.orEmpty() | ||
val selectedIconColorPalette = uiTheme?.selectedIconColorPalette.orEmpty().mapValues { | ||
ColorUtil.fromHex(it.value).rgb | ||
} | ||
|
||
val colorPalette = UITheme.getColorPalette() | ||
return BridgeIconData(iconMap, colorPalette, selectedIconColorPalette) | ||
} | ||
} | ||
val colorPalette = UITheme.getColorPalette() | ||
return ThemeIconData(iconMap, colorPalette, selectedIconColorPalette) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.