Skip to content

Commit b414e00

Browse files
rock3rintellij-monorepo-bot
authored andcommitted
[JEWEL-877] Include CSS LinearGradientBrush and sample
This adds the `Brush.cssLinearGradientBrush()` API, which allows users to draw linear gradients using a CSS-like semantic. This is based on a blog post I wrote last year, and it's been used as-is already in the Gemini in Android Studio UI. In addition to the brush itself, this also adds a Brushes section to the showcase where one can test and preview this brush' behaviour with different parameters. Lastly, this adds a few colour helper functions, including overloads for existing ones (that are now deprecated in favour of the new ones). This brings all colour util functions to support both ARGB and RGBA in both input and output, to/from AWT and Compose `Color`s. We also now finally have unit tests and proper KDoc for all the util functions. Note: we're explicitly excluding the IDE sample plugin from the GitHub CI as it's bound to have compilation issues as we add new APIs that aren't yet available in a target build of the IDE. We still run ktlint and ktfmt for the IDE sample, as they do not depend on compileKotlin. closes #3121 GitOrigin-RevId: d512f23028d444e38a1018ea6e2ed0f44afd91f3
1 parent 2fe7a4d commit b414e00

File tree

21 files changed

+1292
-76
lines changed

21 files changed

+1292
-76
lines changed

platform/jewel/samples/showcase/api-dump.txt

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1+
f:org.jetbrains.jewel.samples.showcase.ShowcaseIcons
2+
- sf:$stable:I
3+
- sf:INSTANCE:org.jetbrains.jewel.samples.showcase.ShowcaseIcons
4+
- f:getComponentsMenu():org.jetbrains.jewel.ui.icon.PathIconKey
5+
- f:getGitHub():org.jetbrains.jewel.ui.icon.PathIconKey
6+
- f:getJewelLogo():org.jetbrains.jewel.ui.icon.PathIconKey
7+
- f:getMarkdown():org.jetbrains.jewel.ui.icon.PathIconKey
8+
- f:getThemeDark():org.jetbrains.jewel.ui.icon.PathIconKey
9+
- f:getThemeLight():org.jetbrains.jewel.ui.icon.PathIconKey
10+
- f:getThemeLightWithLightHeader():org.jetbrains.jewel.ui.icon.PathIconKey
11+
- f:getThemeSystem():org.jetbrains.jewel.ui.icon.PathIconKey
12+
- f:getWelcome():org.jetbrains.jewel.ui.icon.PathIconKey
13+
f:org.jetbrains.jewel.samples.showcase.ShowcaseIcons$Components
14+
- sf:$stable:I
15+
- sf:INSTANCE:org.jetbrains.jewel.samples.showcase.ShowcaseIcons$Components
16+
- f:getBanners():org.jetbrains.jewel.ui.icon.PathIconKey
17+
- f:getBorders():org.jetbrains.jewel.ui.icon.PathIconKey
18+
- f:getBrush():org.jetbrains.jewel.ui.icon.PathIconKey
19+
- f:getButton():org.jetbrains.jewel.ui.icon.PathIconKey
20+
- f:getCheckbox():org.jetbrains.jewel.ui.icon.PathIconKey
21+
- f:getComboBox():org.jetbrains.jewel.ui.icon.PathIconKey
22+
- f:getLinks():org.jetbrains.jewel.ui.icon.PathIconKey
23+
- f:getProgressBar():org.jetbrains.jewel.ui.icon.PathIconKey
24+
- f:getRadioButton():org.jetbrains.jewel.ui.icon.PathIconKey
25+
- f:getScrollbar():org.jetbrains.jewel.ui.icon.PathIconKey
26+
- f:getSegmentedControls():org.jetbrains.jewel.ui.icon.PathIconKey
27+
- f:getSlider():org.jetbrains.jewel.ui.icon.PathIconKey
28+
- f:getSplitlayout():org.jetbrains.jewel.ui.icon.PathIconKey
29+
- f:getTabs():org.jetbrains.jewel.ui.icon.PathIconKey
30+
- f:getTextArea():org.jetbrains.jewel.ui.icon.PathIconKey
31+
- f:getTextField():org.jetbrains.jewel.ui.icon.PathIconKey
32+
- f:getToolbar():org.jetbrains.jewel.ui.icon.PathIconKey
33+
- f:getTooltip():org.jetbrains.jewel.ui.icon.PathIconKey
34+
- f:getTree():org.jetbrains.jewel.ui.icon.PathIconKey
35+
- f:getTypography():org.jetbrains.jewel.ui.icon.PathIconKey
36+
f:org.jetbrains.jewel.samples.showcase.ShowcaseIcons$ProgrammingLanguages
37+
- sf:$stable:I
38+
- sf:INSTANCE:org.jetbrains.jewel.samples.showcase.ShowcaseIcons$ProgrammingLanguages
39+
- f:getKotlin():org.jetbrains.jewel.ui.icon.PathIconKey
140
f:org.jetbrains.jewel.samples.showcase.components.BannersKt
241
- sf:Banners(androidx.compose.runtime.Composer,I):V
342
f:org.jetbrains.jewel.samples.showcase.components.BordersKt
@@ -124,44 +163,6 @@ f:org.jetbrains.jewel.samples.showcase.components.ScrollbarsKt
124163
- sf:Scrollbars(org.jetbrains.jewel.ui.component.styling.ScrollbarVisibility,org.jetbrains.jewel.ui.component.styling.ScrollbarVisibility,androidx.compose.runtime.Composer,I):V
125164
f:org.jetbrains.jewel.samples.showcase.components.SegmentedControlsKt
126165
- sf:SegmentedControls(androidx.compose.runtime.Composer,I):V
127-
f:org.jetbrains.jewel.samples.showcase.components.ShowcaseIcons
128-
- sf:$stable:I
129-
- sf:INSTANCE:org.jetbrains.jewel.samples.showcase.components.ShowcaseIcons
130-
- f:getComponentsMenu():org.jetbrains.jewel.ui.icon.PathIconKey
131-
- f:getGitHub():org.jetbrains.jewel.ui.icon.PathIconKey
132-
- f:getJewelLogo():org.jetbrains.jewel.ui.icon.PathIconKey
133-
- f:getMarkdown():org.jetbrains.jewel.ui.icon.PathIconKey
134-
- f:getThemeDark():org.jetbrains.jewel.ui.icon.PathIconKey
135-
- f:getThemeLight():org.jetbrains.jewel.ui.icon.PathIconKey
136-
- f:getThemeLightWithLightHeader():org.jetbrains.jewel.ui.icon.PathIconKey
137-
- f:getThemeSystem():org.jetbrains.jewel.ui.icon.PathIconKey
138-
- f:getWelcome():org.jetbrains.jewel.ui.icon.PathIconKey
139-
f:org.jetbrains.jewel.samples.showcase.components.ShowcaseIcons$Components
140-
- sf:$stable:I
141-
- sf:INSTANCE:org.jetbrains.jewel.samples.showcase.components.ShowcaseIcons$Components
142-
- f:getBanners():org.jetbrains.jewel.ui.icon.PathIconKey
143-
- f:getBorders():org.jetbrains.jewel.ui.icon.PathIconKey
144-
- f:getButton():org.jetbrains.jewel.ui.icon.PathIconKey
145-
- f:getCheckbox():org.jetbrains.jewel.ui.icon.PathIconKey
146-
- f:getComboBox():org.jetbrains.jewel.ui.icon.PathIconKey
147-
- f:getLinks():org.jetbrains.jewel.ui.icon.PathIconKey
148-
- f:getProgressBar():org.jetbrains.jewel.ui.icon.PathIconKey
149-
- f:getRadioButton():org.jetbrains.jewel.ui.icon.PathIconKey
150-
- f:getScrollbar():org.jetbrains.jewel.ui.icon.PathIconKey
151-
- f:getSegmentedControls():org.jetbrains.jewel.ui.icon.PathIconKey
152-
- f:getSlider():org.jetbrains.jewel.ui.icon.PathIconKey
153-
- f:getSplitlayout():org.jetbrains.jewel.ui.icon.PathIconKey
154-
- f:getTabs():org.jetbrains.jewel.ui.icon.PathIconKey
155-
- f:getTextArea():org.jetbrains.jewel.ui.icon.PathIconKey
156-
- f:getTextField():org.jetbrains.jewel.ui.icon.PathIconKey
157-
- f:getToolbar():org.jetbrains.jewel.ui.icon.PathIconKey
158-
- f:getTooltip():org.jetbrains.jewel.ui.icon.PathIconKey
159-
- f:getTree():org.jetbrains.jewel.ui.icon.PathIconKey
160-
- f:getTypography():org.jetbrains.jewel.ui.icon.PathIconKey
161-
f:org.jetbrains.jewel.samples.showcase.components.ShowcaseIcons$ProgrammingLanguages
162-
- sf:$stable:I
163-
- sf:INSTANCE:org.jetbrains.jewel.samples.showcase.components.ShowcaseIcons$ProgrammingLanguages
164-
- f:getKotlin():org.jetbrains.jewel.ui.icon.PathIconKey
165166
f:org.jetbrains.jewel.samples.showcase.components.SliderKt
166167
- sf:Sliders(androidx.compose.runtime.Composer,I):V
167168
f:org.jetbrains.jewel.samples.showcase.components.SplitLayoutsKt
@@ -189,6 +190,7 @@ f:org.jetbrains.jewel.samples.showcase.views.ComposableSingletons$ComponentsView
189190
- sf:INSTANCE:org.jetbrains.jewel.samples.showcase.views.ComposableSingletons$ComponentsViewModelKt
190191
- <init>():V
191192
- f:getLambda$-1046460726$intellij_platform_jewel_samples_showcase():kotlin.jvm.functions.Function2
193+
- f:getLambda$-1136736643$intellij_platform_jewel_samples_showcase():kotlin.jvm.functions.Function2
192194
- f:getLambda$-1239391927$intellij_platform_jewel_samples_showcase():kotlin.jvm.functions.Function2
193195
- f:getLambda$-1329667844$intellij_platform_jewel_samples_showcase():kotlin.jvm.functions.Function2
194196
- f:getLambda$-1432323128$intellij_platform_jewel_samples_showcase():kotlin.jvm.functions.Function2
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the
2-
// Apache 2.0 license.
3-
package org.jetbrains.jewel.samples.showcase.components
1+
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
package org.jetbrains.jewel.samples.showcase
43

54
import org.jetbrains.jewel.ui.icon.PathIconKey
65

@@ -19,6 +18,7 @@ public object ShowcaseIcons {
1918
public object Components {
2019
public val banners: PathIconKey = PathIconKey("icons/components/banners.svg", ShowcaseIcons::class.java)
2120
public val borders: PathIconKey = PathIconKey("icons/components/borders.svg", ShowcaseIcons::class.java)
21+
public val brush: PathIconKey = PathIconKey("icons/components/brush.svg", ShowcaseIcons::class.java)
2222
public val button: PathIconKey = PathIconKey("icons/components/button.svg", ShowcaseIcons::class.java)
2323
public val checkbox: PathIconKey = PathIconKey("icons/components/checkBox.svg", ShowcaseIcons::class.java)
2424
public val comboBox: PathIconKey = PathIconKey("icons/components/comboBox.svg", ShowcaseIcons::class.java)

platform/jewel/samples/showcase/src/main/kotlin/org/jetbrains/jewel/samples/showcase/components/ComboBoxes.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import androidx.compose.ui.Modifier
1818
import androidx.compose.ui.text.style.TextOverflow
1919
import androidx.compose.ui.unit.dp
2020
import org.jetbrains.jewel.foundation.theme.JewelTheme
21+
import org.jetbrains.jewel.samples.showcase.ShowcaseIcons
2122
import org.jetbrains.jewel.ui.component.ComboBox
2223
import org.jetbrains.jewel.ui.component.DefaultButton
2324
import org.jetbrains.jewel.ui.component.EditableComboBox

0 commit comments

Comments
 (0)