IJPL-43531 Support light/dark onboarding backgrounds in IDEA

GitOrigin-RevId: 0d78ce5e56673f7e868c8b579d742c1b7a572442
This commit is contained in:
Aydar Mukhametzyanov
2024-04-13 12:52:48 +02:00
committed by intellij-monorepo-bot
parent c899faac37
commit 4c1fc883e6
8 changed files with 64 additions and 9 deletions

View File

@@ -17,7 +17,7 @@ interface OnboardingBackgroundImageProvider {
val isAvailable: Boolean get() = ExperimentalUI.isNewUI() && Registry.`is`("ide.onboarding.background.enabled", true)
fun getImage(): Image?
fun getImage(isDark: Boolean): Image?
fun setBackgroundImageToDialog(dialog: DialogWrapper, image: Image?)
fun hasBackgroundImage(dialog: DialogWrapper): Boolean
}

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -0,0 +1,52 @@
<svg width="640" height="500" viewBox="0 0 640 500" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_10_5958)">
<rect width="640" height="500" fill="#F7F8FA"/>
<g clip-path="url(#clip1_10_5958)">
<g opacity="0.4" filter="url(#filter0_f_10_5958)">
<ellipse cx="87" cy="24" rx="300" ry="375" transform="rotate(-90 87 24)" fill="url(#paint0_radial_10_5958)"/>
</g>
<g opacity="0.5" filter="url(#filter1_f_10_5958)">
<ellipse cx="338" cy="53" rx="250" ry="450" transform="rotate(-90 338 53)" fill="url(#paint1_radial_10_5958)"/>
</g>
<g opacity="0.4" filter="url(#filter2_f_10_5958)">
<ellipse cx="645" cy="310" rx="275" ry="300" transform="rotate(-90 645 310)" fill="url(#paint2_radial_10_5958)"/>
</g>
</g>
</g>
<defs>
<filter id="filter0_f_10_5958" x="-388" y="-376" width="950" height="800" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="50" result="effect1_foregroundBlur_10_5958"/>
</filter>
<filter id="filter1_f_10_5958" x="-212" y="-297" width="1100" height="700" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="50" result="effect1_foregroundBlur_10_5958"/>
</filter>
<filter id="filter2_f_10_5958" x="245" y="-65" width="800" height="750" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="50" result="effect1_foregroundBlur_10_5958"/>
</filter>
<radialGradient id="paint0_radial_10_5958" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(87 24) rotate(-178.698) scale(300.077 375.027)">
<stop stop-color="#FD630D"/>
<stop offset="1" stop-color="#F7F8FA" stop-opacity="0"/>
</radialGradient>
<radialGradient id="paint1_radial_10_5958" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(433.912 8.95753) rotate(-159.766) scale(317.424 291.85)">
<stop stop-color="#FE2875"/>
<stop offset="0.9999" stop-color="#F7F8FA" stop-opacity="0.01"/>
<stop offset="1" stop-color="#27282E" stop-opacity="0"/>
</radialGradient>
<radialGradient id="paint2_radial_10_5958" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(667.449 419.787) rotate(-77.6982) scale(329.262 235.542)">
<stop stop-color="#0068FD"/>
<stop offset="1" stop-color="#F7F8FA" stop-opacity="0"/>
</radialGradient>
<clipPath id="clip0_10_5958">
<rect width="640" height="500" fill="white"/>
</clipPath>
<clipPath id="clip1_10_5958">
<rect width="1065.08" height="1168.26" fill="white" transform="translate(-410 -102)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -1 +1 @@
skip: gradientBackground.svg
skip: gradientBackground*

View File

@@ -18,10 +18,10 @@ import java.net.URL
@Internal
abstract class OnboardingBackgroundImageProviderBase : OnboardingBackgroundImageProvider {
open fun getImageUrl(): URL? = null
open fun getImageUrl(isDark: Boolean): URL? = null
override fun getImage(): Image? {
val imageUrl = getImageUrl()?.takeIf { isAvailable && it.path.endsWith(".svg"); } ?: return null
override fun getImage(isDark: Boolean): Image? {
val imageUrl = getImageUrl(isDark)?.takeIf { isAvailable && it.path.endsWith(".svg"); } ?: return null
val image: Image? = BackgroundTaskUtil.tryComputeFast(
{ progressIndicator ->

View File

@@ -7,7 +7,8 @@ import java.net.URL
@Internal
class OnboardingBackgroundImageProviderImpl : OnboardingBackgroundImageProviderBase() {
override fun getImageUrl(): URL? =
if (PlatformUtils.isIntelliJ()) javaClass.getResource("/images/gradientBackground.svg")
override fun getImageUrl(isDark: Boolean): URL? =
if (PlatformUtils.isIntelliJ()) javaClass.getResource(if (isDark) "/images/gradientBackground-dark.svg"
else "/images/gradientBackground-light.svg")
else null
}

View File

@@ -9,6 +9,7 @@ import com.intellij.ide.startup.importSettings.data.DialogImportData
import com.intellij.ide.startup.importSettings.data.SettingsContributor
import com.intellij.ide.startup.importSettings.data.SettingsService
import com.intellij.ide.startup.importSettings.statistics.ImportSettingsEventsCollector
import com.intellij.ide.ui.LafManager
import com.intellij.openapi.ui.OnboardingBackgroundImageProvider
import com.intellij.openapi.util.Disposer
@@ -55,7 +56,8 @@ private class ImportSettingsControllerImpl(dialog: OnboardingDialog, override va
}
override fun goToProductChooserPage() {
val page = ProductChooserPage(this, OnboardingBackgroundImageProvider.getInstance().getImage())
val isDark = LafManager.getInstance().currentUIThemeLookAndFeel?.isDark ?: true
val page = ProductChooserPage(this, OnboardingBackgroundImageProvider.getInstance().getImage(isDark))
Disposer.tryRegister(dialog.disposable, page)
ImportSettingsEventsCollector.productPageShown()
dialog.changePage(page)

View File

@@ -5,5 +5,5 @@ import com.intellij.openapi.wm.impl.OnboardingBackgroundImageProviderBase
import java.net.URL
internal class PyCharmOnboardingBackgroundImageProvider : OnboardingBackgroundImageProviderBase() {
override fun getImageUrl(): URL? = javaClass.getResource("/img/pycharm-onboarding-gradient-background.svg")
override fun getImageUrl(isDark: Boolean): URL? = javaClass.getResource("/img/pycharm-onboarding-gradient-background.svg")
}