Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REVIEW ONLY] - Reallocate styles in appropriate files #713

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions ide-laf-bridge/api/ide-laf-bridge.api
Original file line number Diff line number Diff line change
Expand Up @@ -136,27 +136,12 @@ public final class org/jetbrains/jewel/bridge/theme/BridgeGlobalMetricsKt {
public static final fun readFromLaF (Lorg/jetbrains/jewel/foundation/GlobalMetrics$Companion;)Lorg/jetbrains/jewel/foundation/GlobalMetrics;
}

public final class org/jetbrains/jewel/bridge/theme/BridgeSliderStylingKt {
public static final fun dark-7HESe_I (Lorg/jetbrains/jewel/ui/component/styling/SliderColors$Companion;JJJJJJJJJJJJJJJ)Lorg/jetbrains/jewel/ui/component/styling/SliderColors;
public static synthetic fun dark-7HESe_I$default (Lorg/jetbrains/jewel/ui/component/styling/SliderColors$Companion;JJJJJJJJJJJJJJJILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/SliderColors;
public static final fun defaults-IDSuZpE (Lorg/jetbrains/jewel/ui/component/styling/SliderMetrics$Companion;FJFFFF)Lorg/jetbrains/jewel/ui/component/styling/SliderMetrics;
public static synthetic fun defaults-IDSuZpE$default (Lorg/jetbrains/jewel/ui/component/styling/SliderMetrics$Companion;FJFFFFILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/SliderMetrics;
public static final fun light-7HESe_I (Lorg/jetbrains/jewel/ui/component/styling/SliderColors$Companion;JJJJJJJJJJJJJJJ)Lorg/jetbrains/jewel/ui/component/styling/SliderColors;
public static synthetic fun light-7HESe_I$default (Lorg/jetbrains/jewel/ui/component/styling/SliderColors$Companion;JJJJJJJJJJJJJJJILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/SliderColors;
}

public final class org/jetbrains/jewel/bridge/theme/BridgeThemeColorPaletteKt {
public static final fun getWindowsPopupBorder (Lorg/jetbrains/jewel/foundation/theme/ThemeColorPalette;)Landroidx/compose/ui/graphics/Color;
public static final fun readFromLaF (Lorg/jetbrains/jewel/foundation/theme/ThemeColorPalette$Companion;)Lorg/jetbrains/jewel/foundation/theme/ThemeColorPalette;
}

public final class org/jetbrains/jewel/bridge/theme/IntUiBridgeTextKt {
public static final fun retrieveConsoleTextStyle ()Landroidx/compose/ui/text/TextStyle;
public static final fun retrieveDefaultTextStyle ()Landroidx/compose/ui/text/TextStyle;
public static final fun retrieveEditorTextStyle ()Landroidx/compose/ui/text/TextStyle;
}

public final class org/jetbrains/jewel/bridge/theme/ScrollbarBridgeKt {
public final class org/jetbrains/jewel/bridge/theme/IntUiBridgeScrollbarKt {
public static final fun default (Lorg/jetbrains/jewel/ui/component/styling/ScrollbarVisibility$AlwaysVisible$Companion;)Lorg/jetbrains/jewel/ui/component/styling/ScrollbarVisibility$AlwaysVisible;
public static final fun default (Lorg/jetbrains/jewel/ui/component/styling/ScrollbarVisibility$WhenScrolling$Companion;)Lorg/jetbrains/jewel/ui/component/styling/ScrollbarVisibility$WhenScrolling;
public static final fun macOs-TZvXluI (Lorg/jetbrains/jewel/ui/component/styling/ScrollbarVisibility$WhenScrolling$Companion;FFLandroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/layout/PaddingValues;JJJJ)Lorg/jetbrains/jewel/ui/component/styling/ScrollbarVisibility$WhenScrolling;
Expand All @@ -169,6 +154,21 @@ public final class org/jetbrains/jewel/bridge/theme/ScrollbarBridgeKt {
public static synthetic fun windowsAndLinux-tYhzLtE$default (Lorg/jetbrains/jewel/ui/component/styling/ScrollbarVisibility$AlwaysVisible$Companion;FLandroidx/compose/foundation/layout/PaddingValues;JJILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/ScrollbarVisibility$AlwaysVisible;
}

public final class org/jetbrains/jewel/bridge/theme/IntUiBridgeSliderKt {
public static final fun dark-7HESe_I (Lorg/jetbrains/jewel/ui/component/styling/SliderColors$Companion;JJJJJJJJJJJJJJJ)Lorg/jetbrains/jewel/ui/component/styling/SliderColors;
public static synthetic fun dark-7HESe_I$default (Lorg/jetbrains/jewel/ui/component/styling/SliderColors$Companion;JJJJJJJJJJJJJJJILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/SliderColors;
public static final fun defaults-IDSuZpE (Lorg/jetbrains/jewel/ui/component/styling/SliderMetrics$Companion;FJFFFF)Lorg/jetbrains/jewel/ui/component/styling/SliderMetrics;
public static synthetic fun defaults-IDSuZpE$default (Lorg/jetbrains/jewel/ui/component/styling/SliderMetrics$Companion;FJFFFFILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/SliderMetrics;
public static final fun light-7HESe_I (Lorg/jetbrains/jewel/ui/component/styling/SliderColors$Companion;JJJJJJJJJJJJJJJ)Lorg/jetbrains/jewel/ui/component/styling/SliderColors;
public static synthetic fun light-7HESe_I$default (Lorg/jetbrains/jewel/ui/component/styling/SliderColors$Companion;JJJJJJJJJJJJJJJILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/SliderColors;
}

public final class org/jetbrains/jewel/bridge/theme/IntUiBridgeTextKt {
public static final fun retrieveConsoleTextStyle ()Landroidx/compose/ui/text/TextStyle;
public static final fun retrieveDefaultTextStyle ()Landroidx/compose/ui/text/TextStyle;
public static final fun retrieveEditorTextStyle ()Landroidx/compose/ui/text/TextStyle;
}

public final class org/jetbrains/jewel/bridge/theme/SwingBridgeThemeKt {
public static final fun SwingBridgeTheme (Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;I)V
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ import org.jetbrains.jewel.foundation.Stroke
import org.jetbrains.jewel.ui.component.styling.ButtonColors
import org.jetbrains.jewel.ui.component.styling.ButtonMetrics
import org.jetbrains.jewel.ui.component.styling.ButtonStyle
import org.jetbrains.jewel.ui.component.styling.IconButtonColors
import org.jetbrains.jewel.ui.component.styling.IconButtonMetrics
import org.jetbrains.jewel.ui.component.styling.IconButtonStyle
import org.jetbrains.jewel.ui.component.styling.SegmentedControlButtonColors
import org.jetbrains.jewel.ui.component.styling.SegmentedControlButtonMetrics
import org.jetbrains.jewel.ui.component.styling.SegmentedControlButtonStyle

internal fun readDefaultButtonStyle(): ButtonStyle {
val normalBackground =
Expand Down Expand Up @@ -127,78 +121,3 @@ internal fun readOutlinedButtonStyle(): ButtonStyle {
focusOutlineAlignment = Stroke.Alignment.Center,
)
}

internal fun readSegmentedControlButtonStyle(): SegmentedControlButtonStyle {
val selectedBackground = SolidColor(JBUI.CurrentTheme.SegmentedButton.SELECTED_BUTTON_COLOR.toComposeColor())

val normalBorder =
listOf(
JBUI.CurrentTheme.SegmentedButton.SELECTED_START_BORDER_COLOR.toComposeColor(),
JBUI.CurrentTheme.SegmentedButton.SELECTED_END_BORDER_COLOR.toComposeColor(),
)
.createVerticalBrush()

val selectedDisabledBorder =
listOf(
JBUI.CurrentTheme.Button.buttonOutlineColorStart(false).toComposeColor(),
JBUI.CurrentTheme.Button.buttonOutlineColorEnd(false).toComposeColor(),
)
.createVerticalBrush()

val colors =
SegmentedControlButtonColors(
background = SolidColor(Color.Transparent),
backgroundPressed = selectedBackground,
backgroundHovered = SolidColor(JBUI.CurrentTheme.ActionButton.hoverBackground().toComposeColor()),
backgroundSelected = selectedBackground,
backgroundSelectedFocused =
SolidColor(JBUI.CurrentTheme.SegmentedButton.FOCUSED_SELECTED_BUTTON_COLOR.toComposeColor()),
content = retrieveColorOrUnspecified("Button.foreground"),
contentDisabled = retrieveColorOrUnspecified("Label.disabledForeground"),
border = normalBorder,
borderSelected = normalBorder,
borderSelectedDisabled = selectedDisabledBorder,
borderSelectedFocused = SolidColor(JBUI.CurrentTheme.Button.focusBorderColor(false).toComposeColor()),
)

val minimumSize = JBUI.CurrentTheme.Button.minimumSize().toDpSize()
return SegmentedControlButtonStyle(
colors = colors,
metrics =
SegmentedControlButtonMetrics(
cornerSize = CornerSize(DarculaUIUtil.BUTTON_ARC.dp / 2),
segmentedButtonPadding = PaddingValues(horizontal = 14.dp),
minSize = DpSize(minimumSize.width, minimumSize.height),
borderWidth = DarculaUIUtil.LW.dp,
),
)
}

internal fun readIconButtonStyle(): IconButtonStyle =
IconButtonStyle(
metrics =
IconButtonMetrics(
cornerSize = CornerSize(DarculaUIUtil.BUTTON_ARC.dp / 2),
borderWidth = 1.dp,
padding = PaddingValues(0.dp),
minSize = DpSize(24.dp, 24.dp),
),
colors =
IconButtonColors(
foregroundSelectedActivated = retrieveColorOrUnspecified("ToolWindow.Button.selectedForeground"),
background = Color.Unspecified,
backgroundDisabled = Color.Unspecified,
backgroundSelected = retrieveColorOrUnspecified("ActionButton.pressedBackground"),
backgroundSelectedActivated = retrieveColorOrUnspecified("ToolWindow.Button.selectedBackground"),
backgroundPressed = retrieveColorOrUnspecified("ActionButton.pressedBackground"),
backgroundHovered = retrieveColorOrUnspecified("ActionButton.hoverBackground"),
backgroundFocused = retrieveColorOrUnspecified("ActionButton.hoverBackground"),
border = Color.Unspecified,
borderDisabled = Color.Unspecified,
borderSelected = retrieveColorOrUnspecified("ActionButton.pressedBackground"),
borderSelectedActivated = retrieveColorOrUnspecified("ToolWindow.Button.selectedBackground"),
borderFocused = Color.Unspecified,
borderPressed = retrieveColorOrUnspecified("ActionButton.pressedBorderColor"),
borderHovered = retrieveColorOrUnspecified("ActionButton.hoverBorderColor"),
),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.jetbrains.jewel.bridge.theme

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.takeOrElse
import kotlin.time.Duration.Companion.milliseconds
import org.jetbrains.jewel.bridge.retrieveColorOrUnspecified
import org.jetbrains.jewel.ui.component.styling.CircularProgressStyle

internal fun readCircularProgressStyle(isDark: Boolean) =
CircularProgressStyle(
frameTime = 125.milliseconds,
color =
retrieveColorOrUnspecified("ProgressIcon.color").takeOrElse {
if (isDark) Color(0xFF6F737A) else Color(0xFFA8ADBD)
},
)
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
package org.jetbrains.jewel.bridge.theme

import androidx.compose.foundation.shape.CornerSize
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.takeOrElse
import androidx.compose.ui.unit.dp
import kotlin.time.Duration.Companion.milliseconds
import org.jetbrains.jewel.bridge.retrieveColorOrUnspecified
import org.jetbrains.jewel.ui.component.styling.CircularProgressStyle
import org.jetbrains.jewel.ui.component.styling.HorizontalProgressBarColors
import org.jetbrains.jewel.ui.component.styling.HorizontalProgressBarMetrics
import org.jetbrains.jewel.ui.component.styling.HorizontalProgressBarStyle

internal fun readCircularProgressStyle(isDark: Boolean) =
CircularProgressStyle(
frameTime = 125.milliseconds,
color =
retrieveColorOrUnspecified("ProgressIcon.color").takeOrElse {
if (isDark) Color(0xFF6F737A) else Color(0xFFA8ADBD)
},
)

internal fun readHorizontalProgressBarStyle() =
HorizontalProgressBarStyle(
colors =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.jetbrains.jewel.bridge.theme

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.shape.CornerSize
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import com.intellij.ide.ui.laf.darcula.DarculaUIUtil
import org.jetbrains.jewel.bridge.dp
import org.jetbrains.jewel.bridge.retrieveColorOrUnspecified
import org.jetbrains.jewel.ui.component.styling.IconButtonColors
import org.jetbrains.jewel.ui.component.styling.IconButtonMetrics
import org.jetbrains.jewel.ui.component.styling.IconButtonStyle

internal fun readIconButtonStyle(): IconButtonStyle =
IconButtonStyle(
metrics =
IconButtonMetrics(
cornerSize = CornerSize(DarculaUIUtil.BUTTON_ARC.dp / 2),
borderWidth = 1.dp,
padding = PaddingValues(0.dp),
minSize = DpSize(24.dp, 24.dp),
),
colors =
IconButtonColors(
foregroundSelectedActivated = retrieveColorOrUnspecified("ToolWindow.Button.selectedForeground"),
background = Color.Unspecified,
backgroundDisabled = Color.Unspecified,
backgroundSelected = retrieveColorOrUnspecified("ActionButton.pressedBackground"),
backgroundSelectedActivated = retrieveColorOrUnspecified("ToolWindow.Button.selectedBackground"),
backgroundPressed = retrieveColorOrUnspecified("ActionButton.pressedBackground"),
backgroundHovered = retrieveColorOrUnspecified("ActionButton.hoverBackground"),
backgroundFocused = retrieveColorOrUnspecified("ActionButton.hoverBackground"),
border = Color.Unspecified,
borderDisabled = Color.Unspecified,
borderSelected = retrieveColorOrUnspecified("ActionButton.pressedBackground"),
borderSelectedActivated = retrieveColorOrUnspecified("ToolWindow.Button.selectedBackground"),
borderFocused = Color.Unspecified,
borderPressed = retrieveColorOrUnspecified("ActionButton.pressedBorderColor"),
borderHovered = retrieveColorOrUnspecified("ActionButton.hoverBorderColor"),
),
)
Loading
Loading