From d7e9252eaa921075ae6ae32f6c26f5c5379be26f Mon Sep 17 00:00:00 2001 From: Oliver Nybroe Date: Wed, 12 Aug 2020 08:57:48 +0200 Subject: [PATCH] feat(icons): Add dark/light mode icons --- CHANGELOG.md | 19 +------------------ gradle.properties | 2 +- src/main/kotlin/com/pestphp/pest/PestIcons.kt | 16 +++++++++++++--- .../PestRunConfigurationSettings.kt | 5 ++++- .../pest/configuration/PestRunnerSettings.kt | 9 ++++++++- src/main/resources/config@dark.svg | 15 +++++++++++++++ src/main/resources/config@light.svg | 12 ++++++++++++ src/main/resources/file@dark.svg | 12 ++++++++++++ src/main/resources/file@light.svg | 9 +++++++++ src/main/resources/pest-config.svg | 16 ---------------- src/main/resources/pest-file.svg | 10 ---------- src/main/resources/pest-run.svg | 16 ---------------- src/main/resources/run@dark.svg | 18 ++++++++++++++++++ src/main/resources/run@light.svg | 12 ++++++++++++ 14 files changed, 105 insertions(+), 66 deletions(-) create mode 100644 src/main/resources/config@dark.svg create mode 100644 src/main/resources/config@light.svg create mode 100644 src/main/resources/file@dark.svg create mode 100644 src/main/resources/file@light.svg delete mode 100644 src/main/resources/pest-config.svg delete mode 100644 src/main/resources/pest-file.svg delete mode 100644 src/main/resources/pest-run.svg create mode 100644 src/main/resources/run@dark.svg create mode 100644 src/main/resources/run@light.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index 21165fbe..ceb6a16f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,29 +4,12 @@ ## [Unreleased] ### Added +- Added dark/light mode icons ([#45](https://github.com/pestphp/pest-intellij/pull/45)) -### Changed - -### Deprecated - -### Removed - -### Fixed - -### Security ## [0.3.1] -### Added - ### Changed - Change the name of the plugin -### Deprecated - -### Removed - -### Fixed - -### Security ## [0.3.0] ### Added - Basic autocompletion for `$this` for PhpUnit TestCase base class ([#11](https://github.com/pestphp/pest-intellij/pull/11)) diff --git a/gradle.properties b/gradle.properties index 89b4d310..fda59e65 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ pluginGroup = com.pestphp pluginName = PEST PHP -pluginVersion = 0.3.1 +pluginVersion = 0.3.2 pluginSinceBuild = 201 pluginUntilBuild = null diff --git a/src/main/kotlin/com/pestphp/pest/PestIcons.kt b/src/main/kotlin/com/pestphp/pest/PestIcons.kt index 6acf59e8..03f8f320 100644 --- a/src/main/kotlin/com/pestphp/pest/PestIcons.kt +++ b/src/main/kotlin/com/pestphp/pest/PestIcons.kt @@ -1,10 +1,20 @@ package com.pestphp.pest +import com.intellij.ide.ui.LafManager +import com.intellij.ide.ui.laf.darcula.DarculaLookAndFeelInfo import com.intellij.openapi.util.IconLoader object PestIcons { val LOGO = IconLoader.getIcon("/logo.svg") - val RUN_SINGLE_TEST = IconLoader.getIcon("/pest-run.svg") - val CONFIG = IconLoader.getIcon("/pest-config.svg") - val FILE = IconLoader.getIcon("/pest-file.svg") + val RUN_SINGLE_TEST = IconLoader.getIcon("/run@${getThemeString()}.svg") + val CONFIG = IconLoader.getIcon("/config@${getThemeString()}.svg") + val FILE = IconLoader.getIcon("/file@${getThemeString()}.svg") + + private fun isDarkMode() = LafManager.getInstance().currentLookAndFeel == DarculaLookAndFeelInfo() + private fun getThemeString(): String { + if (isDarkMode()) { + return "dark" + } + return "light" + } } diff --git a/src/main/kotlin/com/pestphp/pest/configuration/PestRunConfigurationSettings.kt b/src/main/kotlin/com/pestphp/pest/configuration/PestRunConfigurationSettings.kt index ad0ac145..eaffa989 100644 --- a/src/main/kotlin/com/pestphp/pest/configuration/PestRunConfigurationSettings.kt +++ b/src/main/kotlin/com/pestphp/pest/configuration/PestRunConfigurationSettings.kt @@ -1,7 +1,10 @@ package com.pestphp.pest.configuration import com.jetbrains.php.testFramework.run.PhpTestRunConfigurationSettings +import com.jetbrains.php.testFramework.run.PhpTestRunnerSettings class PestRunConfigurationSettings : PhpTestRunConfigurationSettings() { - private val pestRunnerSettings = PestRunnerSettings() + override fun createDefault(): PhpTestRunnerSettings { + return PestRunnerSettings() + } } diff --git a/src/main/kotlin/com/pestphp/pest/configuration/PestRunnerSettings.kt b/src/main/kotlin/com/pestphp/pest/configuration/PestRunnerSettings.kt index 15f3d64d..481940de 100644 --- a/src/main/kotlin/com/pestphp/pest/configuration/PestRunnerSettings.kt +++ b/src/main/kotlin/com/pestphp/pest/configuration/PestRunnerSettings.kt @@ -1,3 +1,10 @@ package com.pestphp.pest.configuration -class PestRunnerSettings +import com.intellij.util.xmlb.annotations.Attribute +import com.jetbrains.php.phpunit.coverage.PhpUnitCoverageEngine.CoverageEngine +import com.jetbrains.php.testFramework.run.PhpTestRunnerSettings + +class PestRunnerSettings : PhpTestRunnerSettings() { + @Attribute("coverage_engine") + var coverageEngine: CoverageEngine = CoverageEngine.XDEBUG +} diff --git a/src/main/resources/config@dark.svg b/src/main/resources/config@dark.svg new file mode 100644 index 00000000..d9a9f30d --- /dev/null +++ b/src/main/resources/config@dark.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/main/resources/config@light.svg b/src/main/resources/config@light.svg new file mode 100644 index 00000000..294db79f --- /dev/null +++ b/src/main/resources/config@light.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/main/resources/file@dark.svg b/src/main/resources/file@dark.svg new file mode 100644 index 00000000..4f6e23f2 --- /dev/null +++ b/src/main/resources/file@dark.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/main/resources/file@light.svg b/src/main/resources/file@light.svg new file mode 100644 index 00000000..9ac5e8da --- /dev/null +++ b/src/main/resources/file@light.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/main/resources/pest-config.svg b/src/main/resources/pest-config.svg deleted file mode 100644 index 235a1254..00000000 --- a/src/main/resources/pest-config.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/main/resources/pest-file.svg b/src/main/resources/pest-file.svg deleted file mode 100644 index bbde237e..00000000 --- a/src/main/resources/pest-file.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/src/main/resources/pest-run.svg b/src/main/resources/pest-run.svg deleted file mode 100644 index ecef2365..00000000 --- a/src/main/resources/pest-run.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/main/resources/run@dark.svg b/src/main/resources/run@dark.svg new file mode 100644 index 00000000..3ecc0752 --- /dev/null +++ b/src/main/resources/run@dark.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/run@light.svg b/src/main/resources/run@light.svg new file mode 100644 index 00000000..7c3f8830 --- /dev/null +++ b/src/main/resources/run@light.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + +