-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
element_geom(pen, brush, paper)
(#836)
* `theme_none()`: use grey colors for elements. * Add theme keys for 'pen', 'brush', 'paper'. Add ColorTheme to access these values. * Use `ColorTheme` colors as default in NamedSystemColors. * Update demo. * Access to colors via `ColorTheme` (also use for color defaults of geometries). * Use `color.paper()` in `GeomContext`. * Check ordering in theme setting to choose which colors to use. * Update demo. * Fix key order in plot spec. * Minor. * Add `element_geom()` to python. Update notebook. * Remove extra import. * Add ThemeConfigTest. * Update future_changes.md. * Reformat code.
- Loading branch information
1 parent
c4a69cb
commit 161af49
Showing
27 changed files
with
732 additions
and
109 deletions.
There are no files selected for viewing
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
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
14 changes: 14 additions & 0 deletions
14
plot-base/src/commonMain/kotlin/org/jetbrains/letsPlot/core/plot/base/theme/ColorTheme.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright (c) 2023. JetBrains s.r.o. | ||
* Use of this source code is governed by the MIT license that can be found in the LICENSE file. | ||
*/ | ||
|
||
package org.jetbrains.letsPlot.core.plot.base.theme | ||
|
||
import org.jetbrains.letsPlot.commons.values.Color | ||
|
||
interface ColorTheme { | ||
fun pen(): Color | ||
fun brush(): Color | ||
fun paper(): Color | ||
} |
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
27 changes: 27 additions & 0 deletions
27
...monMain/kotlin/org/jetbrains/letsPlot/core/plot/builder/defaultTheme/DefaultColorTheme.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) 2023. JetBrains s.r.o. | ||
* Use of this source code is governed by the MIT license that can be found in the LICENSE file. | ||
*/ | ||
|
||
package org.jetbrains.letsPlot.core.plot.builder.defaultTheme | ||
|
||
import org.jetbrains.letsPlot.core.plot.base.theme.ColorTheme | ||
import org.jetbrains.letsPlot.core.plot.builder.defaultTheme.values.ThemeOption.GEOM | ||
import org.jetbrains.letsPlot.core.plot.builder.defaultTheme.values.ThemeOption.Geom.BRUSH | ||
import org.jetbrains.letsPlot.core.plot.builder.defaultTheme.values.ThemeOption.Geom.PAPER | ||
import org.jetbrains.letsPlot.core.plot.builder.defaultTheme.values.ThemeOption.Geom.PEN | ||
import org.jetbrains.letsPlot.core.plot.builder.presentation.FontFamilyRegistry | ||
|
||
internal class DefaultColorTheme( | ||
options: Map<String, Any>, | ||
fontFamilyRegistry: FontFamilyRegistry | ||
) : ThemeValuesAccess(options, fontFamilyRegistry), ColorTheme { | ||
|
||
private val geomElem = getElemValue(listOf(GEOM)) | ||
|
||
override fun pen() = getColor(geomElem, PEN) | ||
|
||
override fun brush() = getColor(geomElem, BRUSH) | ||
|
||
override fun paper() = getColor(geomElem, PAPER) | ||
} |
Oops, something went wrong.